R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(61,65,55,56,91,80,135,129,129,130,109,126,73,68,74,95,105,108,127,108,126,154,127,103,95,59,68,82,92,124,139,167,138,146,128,145,91,66,89,98,113,130,127,157,157,136,145,112,71,95,95,105,116,104,128,181,130,124,123,152) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > par8 <- 'FALSE' > par7 <- '1' > par6 <- '' > par5 <- '1' > par4 <- '' > par3 <- '0' > par2 <- 'periodic' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > par1 <- as.numeric(par1) #seasonal period > if (par2 != 'periodic') par2 <- as.numeric(par2) #s.window > par3 <- as.numeric(par3) #s.degree > if (par4 == '') par4 <- NULL else par4 <- as.numeric(par4)#t.window > par5 <- as.numeric(par5)#t.degree > if (par6 != '') par6 <- as.numeric(par6)#l.window > par7 <- as.numeric(par7)#l.degree > if (par8 == 'FALSE') par8 <- FALSE else par9 <- TRUE #robust > nx <- length(x) > x <- ts(x,frequency=par1) > if (par6 != '') { + m <- stl(x,s.window=par2, s.degree=par3, t.window=par4, t.degre=par5, l.window=par6, l.degree=par7, robust=par8) + } else { + m <- stl(x,s.window=par2, s.degree=par3, t.window=par4, t.degre=par5, l.degree=par7, robust=par8) + } > m$time.series seasonal trend remainder Jan 1 -30.492004 89.67555 1.8164566 Feb 1 -38.621790 90.97670 12.6450913 Mar 1 -33.551546 92.27785 -3.7263035 Apr 1 -22.937467 93.59758 -14.6601102 May 1 -7.123399 94.91731 3.2060939 Jun 1 -1.679401 96.20825 -14.5288514 Jul 1 19.964565 97.49920 17.5362350 Aug 1 36.813326 98.82617 -6.6395000 Sep 1 24.062098 100.15315 4.7847533 Oct 1 25.611727 101.86018 2.5280964 Nov 1 13.561350 103.56720 -8.1285550 Dec 1 14.392541 104.62488 6.9825786 Jan 2 -30.492004 105.68256 -2.1905525 Feb 2 -38.621790 105.73679 0.8850024 Mar 2 -33.551546 105.79102 1.7605278 Apr 2 -22.937467 105.95119 11.9862786 May 2 -7.123399 106.11136 6.0120403 Jun 2 -1.679401 106.29917 3.3802284 Jul 2 19.964565 106.48699 0.5484482 Aug 2 36.813326 106.22730 -35.0406255 Sep 2 24.062098 105.96761 -4.0297110 Oct 2 25.611727 105.62311 22.7651678 Nov 2 13.561350 105.27860 8.1600521 Dec 2 14.392541 106.03599 -17.4285329 Jan 3 -30.492004 106.79339 18.6986173 Feb 3 -38.621790 108.36484 -10.7430549 Mar 3 -33.551546 109.93630 -8.3847565 Apr 3 -22.937467 111.13723 -6.1997584 May 3 -7.123399 112.33815 -13.2147494 Jun 3 -1.679401 113.58316 12.0962396 Jul 3 19.964565 114.82817 4.2072601 Aug 3 36.813326 116.07452 14.1121568 Sep 3 24.062098 117.32086 -3.3829581 Oct 3 25.611727 118.31177 2.0765070 Nov 3 13.561350 119.30267 -4.8640223 Dec 3 14.392541 119.59128 11.0161810 Jan 4 -30.492004 119.87988 1.6121196 Feb 4 -38.621790 119.87543 -15.2536404 Mar 4 -33.551546 119.87098 2.6805701 Apr 4 -22.937467 119.87319 1.0642801 May 4 -7.123399 119.87540 0.2480008 Jun 4 -1.679401 119.48768 12.1917236 Jul 4 19.964565 119.09996 -12.0645221 Aug 4 36.813326 119.05649 1.1301845 Sep 4 24.062098 119.01302 13.9248794 Oct 4 25.611727 119.18060 -8.7923278 Nov 4 13.561350 119.34818 12.0904707 Dec 4 14.392541 119.24316 -21.6357033 Jan 5 -30.492004 119.13815 -17.6461420 Feb 5 -38.621790 118.89950 14.7222886 Mar 5 -33.551546 118.66086 9.8906897 Apr 5 -22.937467 118.28654 9.6509243 May 5 -7.123399 117.91223 5.2111697 Jun 5 -1.679401 117.90566 -12.2262614 Jul 5 19.964565 117.89910 -9.8636608 Aug 5 36.813326 117.87405 26.3126209 Sep 5 24.062098 117.84901 -11.9111091 Oct 5 25.611727 117.74189 -19.3536217 Nov 5 13.561350 117.63478 -8.1961287 Dec 5 14.392541 117.49172 20.1157415 > m$win s t l 601 19 13 > m$deg s t l 0 1 1 > m$jump s t l 61 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/fisher/rcomp/tmp/1v57b1354561063.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(m,main=main) > dev.off() null device 1 > mylagmax <- nx/2 > postscript(file="/var/fisher/rcomp/tmp/2wem61354561063.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > acf(as.numeric(x),lag.max = mylagmax,main='Observed') > acf(as.numeric(m$time.series[,'trend']),na.action=na.pass,lag.max = mylagmax,main='Trend') > acf(as.numeric(m$time.series[,'seasonal']),na.action=na.pass,lag.max = mylagmax,main='Seasonal') > acf(as.numeric(m$time.series[,'remainder']),na.action=na.pass,lag.max = mylagmax,main='Remainder') > par(op) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/3zm371354561063.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > spectrum(as.numeric(x),main='Observed') > spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'trend']),'trend']),main='Trend') > spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'seasonal']),'seasonal']),main='Seasonal') > spectrum(as.numeric(m$time.series[!is.na(m$time.series[,'remainder']),'remainder']),main='Remainder') > par(op) > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/4oxn41354561063.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow = c(2,2)) > cpgram(as.numeric(x),main='Observed') > cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'trend']),'trend']),main='Trend') > cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'seasonal']),'seasonal']),main='Seasonal') > cpgram(as.numeric(m$time.series[!is.na(m$time.series[,'remainder']),'remainder']),main='Remainder') > par(op) > dev.off() null device 1 > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Seasonal Decomposition by Loess - Parameters',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Component',header=TRUE) > a<-table.element(a,'Window',header=TRUE) > a<-table.element(a,'Degree',header=TRUE) > a<-table.element(a,'Jump',header=TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Seasonal',header=TRUE) > a<-table.element(a,m$win['s']) > a<-table.element(a,m$deg['s']) > a<-table.element(a,m$jump['s']) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Trend',header=TRUE) > a<-table.element(a,m$win['t']) > a<-table.element(a,m$deg['t']) > a<-table.element(a,m$jump['t']) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Low-pass',header=TRUE) > a<-table.element(a,m$win['l']) > a<-table.element(a,m$deg['l']) > a<-table.element(a,m$jump['l']) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/5jgbu1354561063.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Seasonal Decomposition by Loess - Time Series Components',6,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'t',header=TRUE) > a<-table.element(a,'Observed',header=TRUE) > a<-table.element(a,'Fitted',header=TRUE) > a<-table.element(a,'Seasonal',header=TRUE) > a<-table.element(a,'Trend',header=TRUE) > a<-table.element(a,'Remainder',header=TRUE) > a<-table.row.end(a) > for (i in 1:nx) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]+m$time.series[i,'remainder']) + a<-table.element(a,m$time.series[i,'seasonal']) + a<-table.element(a,m$time.series[i,'trend']) + a<-table.element(a,m$time.series[i,'remainder']) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/6qa4d1354561063.tab") > > try(system("convert tmp/1v57b1354561063.ps tmp/1v57b1354561063.png",intern=TRUE)) character(0) > try(system("convert tmp/2wem61354561063.ps tmp/2wem61354561063.png",intern=TRUE)) character(0) > try(system("convert tmp/3zm371354561063.ps tmp/3zm371354561063.png",intern=TRUE)) character(0) > try(system("convert tmp/4oxn41354561063.ps tmp/4oxn41354561063.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.421 0.634 3.046