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(1.0137 + ,0.9834 + ,0.9643 + ,0.9470 + ,0.9060 + ,0.9492 + ,0.9397 + ,0.9041 + ,0.8721 + ,0.8552 + ,0.8564 + ,0.8973 + ,0.9383 + ,0.9217 + ,0.9095 + ,0.8920 + ,0.8742 + ,0.8532 + ,0.8607 + ,0.9005 + ,0.9111 + ,0.9059 + ,0.8883 + ,0.8924 + ,0.8833 + ,0.8700 + ,0.8758 + ,0.8858 + ,0.9170 + ,0.9554 + ,0.9922 + ,0.9778 + ,0.9808 + ,0.9811 + ,1.0014 + ,1.0183 + ,1.0622 + ,1.0773 + ,1.0807 + ,1.0848 + ,1.1582 + ,1.1663 + ,1.1372 + ,1.1139 + ,1.1222 + ,1.1692 + ,1.1702 + ,1.2286 + ,1.2613 + ,1.2646 + ,1.2262 + ,1.1985 + ,1.2007 + ,1.2138 + ,1.2266 + ,1.2176 + ,1.2218 + ,1.2490 + ,1.2991 + ,1.3408 + ,1.3119 + ,1.3014 + ,1.3201 + ,1.2938 + ,1.2694 + ,1.2165 + ,1.2037 + ,1.2292 + ,1.2256 + ,1.2015 + ,1.1786 + ,1.1856 + ,1.2103 + ,1.1938 + ,1.2020 + ,1.2271 + ,1.2770 + ,1.2650 + ,1.2684 + ,1.2811 + ,1.2727 + ,1.2611 + ,1.2881 + ,1.3213 + ,1.2999 + ,1.3074 + ,1.3242 + ,1.3516 + ,1.3511 + ,1.3419 + ,1.3716 + ,1.3622 + ,1.3896 + ,1.4227 + ,1.4684 + ,1.4570 + ,1.4718 + ,1.4748 + ,1.5527 + ,1.5750 + ,1.5557 + ,1.5553 + ,1.5770 + ,1.4975 + ,1.4369 + ,1.3322 + ,1.2732 + ,1.3449 + ,1.3239 + ,1.2785 + ,1.3050 + ,1.3190 + ,1.3650 + ,1.4016 + ,1.4088 + ,1.4268 + ,1.4562 + ,1.4816 + ,1.4914 + ,1.4614 + ,1.4272 + ,1.3686 + ,1.3569 + ,1.3406 + ,1.2565 + ,1.2208 + ,1.2770 + ,1.2894 + ,1.3067 + ,1.3898 + ,1.3661 + ,1.3220 + ,1.3360 + ,1.3649 + ,1.3999 + ,1.4442 + ,1.4349 + ,1.4388 + ,1.4264 + ,1.4343 + ,1.3770 + ,1.3706 + ,1.3556 + ,1.3179 + ,1.2905 + ,1.3224 + ,1.3201 + ,1.3162 + ,1.2789 + ,1.2526 + ,1.2288 + ,1.2400 + ,1.2856 + ,1.2974 + ,1.2828) > 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 0.0057666218 0.9802756 0.0276577696 Feb 1 -0.0038686018 0.9706379 0.0166306791 Mar 1 0.0026577284 0.9610002 0.0006420350 Apr 1 0.0037406304 0.9519798 -0.0087204750 May 1 -0.0004995241 0.9429595 -0.0364599286 Jun 1 -0.0029339148 0.9345202 0.0176137080 Jul 1 0.0024701727 0.9260810 0.0111488663 Aug 1 -0.0020825718 0.9182592 -0.0120766262 Sep 1 -0.0045122351 0.9104374 -0.0338252001 Oct 1 -0.0016499519 0.9050917 -0.0482417294 Nov 1 -0.0031491924 0.8997459 -0.0401967349 Dec 1 0.0040608515 0.8959587 -0.0027195779 Jan 2 0.0057666218 0.8921715 0.0403618526 Feb 2 -0.0038686018 0.8911411 0.0344275200 Mar 2 0.0026577284 0.8901106 0.0167316338 Apr 2 0.0037406304 0.8912742 -0.0030148629 May 2 -0.0004995241 0.8924378 -0.0177383030 Jun 2 -0.0029339148 0.8917764 -0.0356424960 Jul 2 0.0024701727 0.8911150 -0.0328851673 Aug 2 -0.0020825718 0.8890819 0.0135006436 Sep 2 -0.0045122351 0.8870489 0.0285633733 Oct 2 -0.0016499519 0.8877248 0.0198251944 Nov 2 -0.0031491924 0.8884007 0.0030485393 Dec 2 0.0040608515 0.8932299 -0.0048907138 Jan 3 0.0057666218 0.8980591 -0.0205256933 Feb 3 -0.0038686018 0.9051249 -0.0312563062 Mar 3 0.0026577284 0.9121907 -0.0390484727 Apr 3 0.0037406304 0.9210143 -0.0389549343 May 3 -0.0004995241 0.9298379 -0.0123383395 Jun 3 -0.0029339148 0.9422894 0.0160445132 Jul 3 0.0024701727 0.9547409 0.0349888877 Aug 3 -0.0020825718 0.9703912 0.0094913238 Sep 3 -0.0045122351 0.9860416 -0.0007293214 Oct 3 -0.0016499519 1.0028470 -0.0200970825 Nov 3 -0.0031491924 1.0196525 -0.0151033198 Dec 3 0.0040608515 1.0356561 -0.0214169169 Jan 4 0.0057666218 1.0516596 0.0047737597 Feb 4 -0.0038686018 1.0661165 0.0150521214 Mar 4 0.0026577284 1.0805733 -0.0025310705 Apr 4 0.0037406304 1.0946930 -0.0136336015 May 4 -0.0004995241 1.1088126 0.0498869240 Jun 4 -0.0029339148 1.1235976 0.0456363277 Jul 4 0.0024701727 1.1383826 -0.0036527468 Aug 4 -0.0020825718 1.1521555 -0.0361729146 Sep 4 -0.0045122351 1.1659284 -0.0392161636 Oct 4 -0.0016499519 1.1759461 -0.0050961776 Nov 4 -0.0031491924 1.1859639 -0.0126146678 Dec 4 0.0040608515 1.1932257 0.0313134711 Jan 5 0.0057666218 1.2004875 0.0550458835 Feb 5 -0.0038686018 1.2074741 0.0609945420 Mar 5 0.0026577284 1.2144606 0.0090816468 Apr 5 0.0037406304 1.2209393 -0.0261799298 May 5 -0.0004995241 1.2274180 -0.0262184499 Jun 5 -0.0029339148 1.2337650 -0.0170311318 Jul 5 0.0024701727 1.2401121 -0.0159822919 Aug 5 -0.0020825718 1.2474209 -0.0277383437 Sep 5 -0.0045122351 1.2547297 -0.0284174768 Oct 5 -0.0016499519 1.2621382 -0.0114882415 Nov 5 -0.0031491924 1.2695467 0.0327025176 Dec 5 0.0040608515 1.2730554 0.0636837379 Jan 6 0.0057666218 1.2765641 0.0295692319 Feb 6 -0.0038686018 1.2752524 0.0300162081 Mar 6 0.0026577284 1.2739406 0.0435016306 Apr 6 0.0037406304 1.2673852 0.0226741665 May 6 -0.0004995241 1.2608298 0.0090697589 Jun 6 -0.0029339148 1.2504626 -0.0310287173 Jul 6 0.0024701727 1.2400955 -0.0388656717 Aug 6 -0.0020825718 1.2306017 0.0006808335 Sep 6 -0.0045122351 1.2211080 0.0090042574 Oct 6 -0.0016499519 1.2168095 -0.0136595107 Nov 6 -0.0031491924 1.2125109 -0.0307617550 Dec 6 0.0040608515 1.2144091 -0.0328699660 Jan 7 0.0057666218 1.2163073 -0.0117739033 Feb 7 -0.0038686018 1.2217360 -0.0240673599 Mar 7 0.0026577284 1.2271646 -0.0278223701 Apr 7 0.0037406304 1.2345903 -0.0112308967 May 7 -0.0004995241 1.2420159 0.0354836332 Jun 7 -0.0029339148 1.2511571 0.0167768422 Jul 7 0.0024701727 1.2602983 0.0056315730 Aug 7 -0.0020825718 1.2692595 0.0139230230 Sep 7 -0.0045122351 1.2782208 -0.0010086082 Oct 7 -0.0016499519 1.2863597 -0.0236097909 Nov 7 -0.0031491924 1.2944986 -0.0032494498 Dec 7 0.0040608515 1.3021014 0.0151377981 Jan 8 0.0057666218 1.3097041 -0.0155706804 Feb 8 -0.0038686018 1.3185705 -0.0073018694 Mar 8 0.0026577284 1.3274369 -0.0058946120 Apr 8 0.0037406304 1.3388890 0.0089704021 May 8 -0.0004995241 1.3503411 0.0012584727 Jun 8 -0.0029339148 1.3637581 -0.0189241738 Jul 8 0.0024701727 1.3771751 -0.0080452985 Aug 8 -0.0020825718 1.3927717 -0.0284891302 Sep 8 -0.0045122351 1.4083683 -0.0142560431 Oct 8 -0.0016499519 1.4261432 -0.0017932291 Nov 8 -0.0031491924 1.4439181 0.0276311087 Dec 8 0.0040608515 1.4616331 -0.0086939734 Jan 9 0.0057666218 1.4793482 -0.0133147820 Feb 9 -0.0038686018 1.4902255 -0.0115569137 Mar 9 0.0026577284 1.5011029 0.0489394011 Apr 9 0.0037406304 1.4988441 0.0724152642 May 9 -0.0004995241 1.4965853 0.0596141838 Jun 9 -0.0029339148 1.4834176 0.0748162861 Jul 9 0.0024701727 1.4702499 0.1042799101 Aug 9 -0.0020825718 1.4503680 0.0492145489 Sep 9 -0.0045122351 1.4304861 0.0109261065 Oct 9 -0.0016499519 1.4089578 -0.0751078586 Nov 9 -0.0031491924 1.3874295 -0.1110803000 Dec 9 0.0040608515 1.3723132 -0.0314740749 Jan 10 0.0057666218 1.3571970 -0.0390635761 Feb 10 -0.0038686018 1.3545472 -0.0721785530 Mar 10 0.0026577284 1.3518974 -0.0495550834 Apr 10 0.0037406304 1.3618280 -0.0465686340 May 10 -0.0004995241 1.3717587 -0.0062591281 Jun 10 -0.0029339148 1.3853314 0.0192024727 Jul 10 0.0024701727 1.3989042 0.0074255952 Aug 10 -0.0020825718 1.4075517 0.0213309205 Sep 10 -0.0045122351 1.4161991 0.0445131646 Oct 10 -0.0016499519 1.4150843 0.0681656369 Nov 10 -0.0031491924 1.4139696 0.0805796329 Dec 10 0.0040608515 1.4026537 0.0546854830 Jan 11 0.0057666218 1.3913378 0.0300956066 Feb 11 -0.0038686018 1.3762200 -0.0037513832 Mar 11 0.0026577284 1.3611022 -0.0068599266 Apr 11 0.0037406304 1.3483965 -0.0115371290 May 11 -0.0004995241 1.3356908 -0.0786912749 Jun 11 -0.0029339148 1.3280803 -0.1043463385 Jul 11 0.0024701727 1.3204697 -0.0459398804 Aug 11 -0.0020825718 1.3210671 -0.0295845081 Sep 11 -0.0045122351 1.3216645 -0.0104522171 Oct 11 -0.0016499519 1.3313072 0.0601427205 Nov 11 -0.0031491924 1.3409500 0.0282991819 Dec 11 0.0040608515 1.3548513 -0.0369121874 Jan 12 0.0057666218 1.3687527 -0.0385192831 Feb 12 -0.0038686018 1.3788946 -0.0101260112 Mar 12 0.0026577284 1.3890366 0.0082057072 Apr 12 0.0037406304 1.3929992 0.0474601827 May 12 -0.0004995241 1.3969618 0.0384377146 Jun 12 -0.0029339148 1.3955364 0.0461975305 Jul 12 0.0024701727 1.3941110 0.0298188681 Aug 12 -0.0020825718 1.3875378 0.0488447912 Sep 12 -0.0045122351 1.3809646 0.0005476330 Oct 12 -0.0016499519 1.3694650 0.0027849363 Nov 12 -0.0031491924 1.3579654 0.0007837634 Dec 12 0.0040608515 1.3436642 -0.0298250524 Jan 13 0.0057666218 1.3293630 -0.0446295945 Feb 13 -0.0038686018 1.3180062 0.0082623612 Mar 13 0.0026577284 1.3066495 0.0107927634 Apr 13 0.0037406304 1.2998398 0.0126195571 May 13 -0.0004995241 1.2930301 -0.0136305927 Jun 13 -0.0029339148 1.2865667 -0.0310327629 Jul 13 0.0024701727 1.2801032 -0.0537734113 Aug 13 -0.0020825718 1.2739086 -0.0318260709 Sep 13 -0.0045122351 1.2677140 0.0223981883 Oct 13 -0.0016499519 1.2621303 0.0369196991 Nov 13 -0.0031491924 1.2565465 0.0294027337 > m$win s t l 1551 19 13 > m$deg s t l 0 1 1 > m$jump s t l 156 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/18uch1354721440.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/23ni71354721440.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/30f7y1354721440.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/45ipn1354721440.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/5p1l31354721440.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/6ac7t1354721440.tab") > > try(system("convert tmp/18uch1354721440.ps tmp/18uch1354721440.png",intern=TRUE)) character(0) > try(system("convert tmp/23ni71354721440.ps tmp/23ni71354721440.png",intern=TRUE)) character(0) > try(system("convert tmp/30f7y1354721440.ps tmp/30f7y1354721440.png",intern=TRUE)) character(0) > try(system("convert tmp/45ipn1354721440.ps tmp/45ipn1354721440.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.547 0.601 4.149