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(116,111,104,100,93,91,119,139,134,124,113,109,109,106,101,98,93,91,122,139,140,132,117,114,113,110,107,103,98,98,137,148,147,139,130,128,127,123,118,114,108,111,151,159,158,148,138,137,136,133,126,120,114,116,153,162,161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107,99,103,131,137,135,124,118,121,121,118,113,107,100,102,130,136,133,120,112,109,110,106,102,98,92,92,120,127,124,114,108,106,111,110,104,100,96,98,122,134,133) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > 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 -1.380826 114.6646 2.71626460 Feb 1 -4.509140 114.2915 1.21760034 Mar 1 -9.560530 113.9185 -0.35798725 Apr 1 -13.315755 113.5701 -0.25429655 May 1 -19.301748 113.2216 -0.91983613 Jun 1 -18.383139 112.8703 -3.48719361 Jul 1 13.227780 112.5191 -6.74686138 Aug 1 22.442108 112.1610 4.39693474 Sep 1 20.425671 111.8028 1.77149509 Oct 1 10.259109 111.6429 2.09794656 Nov 1 1.181078 111.4831 0.33586618 Dec 1 -1.084609 111.4580 -1.37334528 Jan 2 -1.380826 111.4329 -1.05202589 Feb 2 -4.509140 111.5875 -1.07837619 Mar 2 -9.560530 111.7422 -1.18164981 Apr 2 -13.315755 112.1734 -0.85765556 May 2 -19.301748 112.6046 -0.30289159 Jun 2 -18.383139 113.1470 -3.76383041 Jul 2 13.227780 113.6893 -4.91707953 Aug 2 22.442108 114.1640 2.39386320 Sep 2 20.425671 114.6388 4.93557016 Oct 2 10.259109 115.1094 6.63149349 Nov 2 1.181078 115.5800 0.23888496 Dec 2 -1.084609 116.1167 -1.03206220 Jan 3 -1.380826 116.6533 -2.27247851 Feb 3 -4.509140 117.2928 -2.78361277 Mar 3 -9.560530 117.9322 -1.37167037 Apr 3 -13.315755 118.8099 -2.49413897 May 3 -19.301748 119.6876 -2.38583785 Jun 3 -18.383139 120.8776 -4.49448759 Jul 3 13.227780 122.0677 1.70455236 Aug 3 22.442108 123.2479 2.30999113 Sep 3 20.425671 124.4281 2.14619414 Oct 3 10.259109 125.3942 3.34664617 Nov 3 1.181078 126.3604 2.45856635 Dec 3 -1.084609 127.2101 1.87449014 Jan 4 -1.380826 128.0599 0.32094478 Feb 4 -4.509140 128.8777 -1.36858918 Mar 4 -9.560530 129.6956 -2.13504646 Apr 4 -13.315755 130.5338 -3.21805807 May 4 -19.301748 131.3720 -4.07029996 Jun 4 -18.383139 132.2477 -2.86457419 Jul 4 13.227780 133.1234 4.64884127 Aug 4 22.442108 133.9694 2.58849091 Sep 4 20.425671 134.8154 2.75890478 Oct 4 10.259109 135.3804 2.36048287 Nov 4 1.181078 135.9454 0.87352910 Dec 4 -1.084609 136.1839 1.90075557 Jan 5 -1.380826 136.4223 0.95851288 Feb 5 -4.509140 136.5357 0.97348418 Mar 5 -9.560530 136.6490 -1.08846785 Apr 5 -13.315755 136.7634 -3.44763883 May 5 -19.301748 136.8778 -3.57604011 Jun 5 -18.383139 136.8202 -2.43709741 Jul 5 13.227780 136.7627 3.00953499 Aug 5 22.442108 136.5179 3.03995310 Sep 5 20.425671 136.2732 4.30113546 Oct 5 10.259109 135.9166 2.82425369 Nov 5 1.181078 135.5601 2.25884008 Dec 5 -1.084609 135.1011 0.98351140 Jan 6 -1.380826 134.6421 -3.26128642 Feb 6 -4.509140 134.2092 -2.70002200 Mar 6 -9.560530 133.7762 -2.21568091 Apr 6 -13.315755 133.5938 -3.27808035 May 6 -19.301748 133.4115 -2.10971008 Jun 6 -18.383139 133.3233 -1.94013906 Jul 6 13.227780 133.2351 2.53712165 Aug 6 22.442108 133.0217 1.53614909 Sep 6 20.425671 132.8084 3.76594076 Oct 6 10.259109 132.4634 4.27746199 Nov 6 1.181078 132.1185 3.70045137 Dec 6 -1.084609 131.6856 1.39904073 Jan 7 -1.380826 131.2527 -4.87183906 Feb 7 -4.509140 130.6369 -3.12775593 Mar 7 -9.560530 130.0211 -3.46059614 Apr 7 -13.315755 129.2192 -1.90348732 May 7 -19.301748 128.4174 1.88439121 Jun 7 -18.383139 127.5192 2.86397775 Jul 7 13.227780 126.6210 4.15125399 Aug 7 22.442108 125.6006 1.95732777 Sep 7 20.425671 124.5802 3.99416579 Oct 7 10.259109 123.2857 0.45519237 Nov 7 1.181078 121.9912 -0.17231289 Dec 7 -1.084609 120.4345 -3.34987853 Jan 8 -1.380826 118.8777 -0.49691333 Feb 8 -4.509140 117.2054 -1.69627561 Mar 8 -9.560530 115.5331 -0.97256121 Apr 8 -13.315755 113.9936 1.32213733 May 8 -19.301748 112.4541 1.84760559 Jun 8 -18.383139 111.2444 0.13871529 Jul 8 13.227780 110.0347 0.73751470 Aug 8 22.442108 109.0752 -1.51727262 Sep 8 20.425671 108.1156 -4.54129570 Oct 8 10.259109 107.3353 -2.59438869 Nov 8 1.181078 106.5549 -1.73601353 Dec 8 -1.084609 105.9558 0.12885040 Jan 9 -1.380826 105.3566 1.02424517 Feb 9 -4.509140 104.8092 0.69996049 Mar 9 -9.560530 104.2618 0.29875249 Apr 9 -13.315755 103.8138 2.50192477 May 9 -19.301748 103.3659 -0.06413323 Jun 9 -18.383139 103.2926 2.09053422 Jul 9 13.227780 103.2193 -0.44710864 Aug 9 22.442108 103.7770 -6.21915732 Sep 9 20.425671 104.3348 -7.76044176 Oct 9 10.259109 105.5043 -6.76342322 Nov 9 1.181078 106.6739 -2.85493653 Dec 9 -1.084609 108.2454 -0.16078868 Jan 10 -1.380826 109.8169 0.56389002 Feb 10 -4.509140 111.4060 2.10318105 Mar 10 -9.560530 112.9950 4.56554876 Apr 10 -13.315755 114.2371 6.07864461 May 10 -19.301748 115.4792 2.82251018 Jun 10 -18.383139 116.3224 5.06071331 Jul 10 13.227780 117.1656 0.60660613 Aug 10 22.442108 117.7073 -3.14939213 Sep 10 20.425671 118.2490 -3.67462615 Oct 10 10.259109 118.5212 -4.78035310 Nov 10 1.181078 118.7935 -1.97461189 Dec 10 -1.084609 118.9469 3.13769925 Jan 11 -1.380826 119.1003 3.28054124 Feb 11 -4.509140 119.0704 3.43877684 Mar 11 -9.560530 119.0404 3.52008911 Apr 11 -13.315755 118.5736 1.74215827 May 11 -19.301748 118.1068 1.19499715 Jun 11 -18.383139 117.1898 3.19335224 Jul 11 13.227780 116.2728 0.49939704 Aug 11 22.442108 115.2560 -1.69811006 Sep 11 20.425671 114.2392 -1.66485292 Oct 11 10.259109 113.3972 -3.65628336 Nov 11 1.181078 112.5552 -1.73624564 Dec 11 -1.084609 111.8751 -1.79048211 Jan 12 -1.380826 111.1950 0.18581227 Feb 12 -4.509140 110.5817 -0.07258850 Mar 12 -9.560530 109.9684 1.59208740 Apr 12 -13.315755 109.4307 1.88502893 May 12 -19.301748 108.8930 2.40874018 Jun 12 -18.383139 108.5762 1.80691546 Jul 12 13.227780 108.2594 -1.48721957 Aug 12 22.442108 108.2702 -3.71231948 Sep 12 20.425671 108.2810 -4.70665516 Oct 12 10.259109 108.6002 -4.85926812 Nov 12 1.181078 108.9193 -2.10041294 Dec 12 -1.084609 109.4754 -2.39078140 Jan 13 -1.380826 110.0314 2.34938099 Feb 13 -4.509140 110.5725 3.93666230 Mar 13 -9.560530 111.1135 2.44702028 Apr 13 -13.315755 111.6894 1.62633909 May 13 -19.301748 112.2653 3.03642760 Jun 13 -18.383139 112.8303 3.55286477 Jul 13 13.227780 113.3952 -4.62300837 Aug 13 22.442108 113.9044 -2.34654937 Sep 13 20.425671 114.4137 -1.83932613 > m$win s t l 1531 19 13 > m$deg s t l 0 1 1 > m$jump s t l 154 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1xg6p1353673853.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/wessaorg/rcomp/tmp/2um501353673853.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/wessaorg/rcomp/tmp/3tk7u1353673853.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/wessaorg/rcomp/tmp/4xi1d1353673853.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/5bdvw1353673853.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/wessaorg/rcomp/tmp/6ln0f1353673853.tab") > > try(system("convert tmp/1xg6p1353673853.ps tmp/1xg6p1353673853.png",intern=TRUE)) character(0) > try(system("convert tmp/2um501353673853.ps tmp/2um501353673853.png",intern=TRUE)) character(0) > try(system("convert tmp/3tk7u1353673853.ps tmp/3tk7u1353673853.png",intern=TRUE)) character(0) > try(system("convert tmp/4xi1d1353673853.ps tmp/4xi1d1353673853.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.952 0.379 3.316