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.2999,1.3074,1.3242,1.3516,1.3511,1.3419,1.3716,1.3622,1.3896,1.4227,1.4684,1.457,1.4718,1.4748,1.5527,1.5751,1.5557,1.5553,1.577,1.4975,1.437,1.3322,1.2732,1.3449,1.3239,1.2785,1.305,1.319,1.365,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.2209,1.277,1.2894,1.3067,1.3898,1.3661,1.322,1.336,1.3649,1.3999,1.4442,1.4349,1.4388,1.4264,1.4343,1.377,1.3706,1.3556,1.3179,1.2905,1.3224,1.3201,1.3162,1.2789,1.2526,1.2288,1.24,1.2856) > 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.0145136793 1.294051 0.0203623638 Feb 1 -0.0209253713 1.307776 0.0205496796 Mar 1 0.0018129774 1.321500 0.0008869546 Apr 1 0.0163998505 1.335847 -0.0006465397 May 1 -0.0010966056 1.350193 0.0020032953 Jun 1 -0.0049800907 1.365022 -0.0181416239 Jul 1 0.0093864271 1.379850 -0.0176365460 Aug 1 0.0051827113 1.394863 -0.0378455625 Sep 1 0.0078623088 1.409876 -0.0281378923 Oct 1 0.0080334052 1.427034 -0.0123677601 Nov 1 0.0008431103 1.444193 0.0233637635 Dec 1 -0.0080050421 1.462182 0.0028231934 Jan 2 -0.0145136793 1.480171 0.0061431080 Feb 2 -0.0209253713 1.491060 0.0046657218 Mar 2 0.0018129774 1.501949 0.0489382949 Apr 2 0.0163998505 1.499181 0.0595191196 May 2 -0.0010966056 1.496413 0.0603832736 Jun 2 -0.0049800907 1.482817 0.0774632924 Jul 2 0.0093864271 1.469220 0.0983933083 Aug 2 0.0051827113 1.449522 0.0427957268 Sep 2 0.0078623088 1.429823 -0.0006851680 Oct 2 0.0080334052 1.408766 -0.0845997287 Nov 2 0.0008431103 1.387710 -0.1153528980 Dec 2 -0.0080050421 1.372864 -0.0199587649 Jan 3 -0.0145136793 1.358018 -0.0196041470 Feb 3 -0.0209253713 1.355376 -0.0559503669 Mar 3 0.0018129774 1.352734 -0.0495466276 Apr 3 0.0163998505 1.362152 -0.0595516991 May 3 -0.0010966056 1.371570 -0.0054734414 Jun 3 -0.0049800907 1.384713 0.0218667087 Jul 3 0.0093864271 1.397857 0.0015568560 Aug 3 0.0051827113 1.406689 0.0149285611 Sep 3 0.0078623088 1.415521 0.0328169529 Oct 3 0.0080334052 1.414881 0.0586859431 Nov 3 0.0008431103 1.414241 0.0763163246 Dec 3 -0.0080050421 1.403199 0.0662063517 Jan 4 -0.0145136793 1.392157 0.0495568635 Feb 4 -0.0209253713 1.377050 0.0124751026 Mar 4 0.0018129774 1.361944 -0.0068566989 Apr 4 0.0163998505 1.348728 -0.0245274630 May 4 -0.0010966056 1.335512 -0.0779148978 Jun 4 -0.0049800907 1.327472 -0.1015915385 Jul 4 0.0093864271 1.319432 -0.0518181822 Aug 4 0.0051827113 1.320213 -0.0359959358 Sep 4 0.0078623088 1.320995 -0.0221570026 Oct 4 0.0080334052 1.331110 0.0506567222 Nov 4 0.0008431103 1.341225 0.0240318385 Dec 4 -0.0080050421 1.355396 -0.0253913182 Jan 5 -0.0145136793 1.369568 -0.0190539902 Feb 5 -0.0209253713 1.379719 0.0061067796 Mar 5 0.0018129774 1.389870 0.0082175086 Apr 5 0.0163998505 1.393321 0.0344789164 May 5 -0.0010966056 1.396773 0.0392236535 Jun 5 -0.0049800907 1.394918 0.0488618922 Jul 5 0.0093864271 1.393063 0.0239501281 Aug 5 0.0051827113 1.386675 0.0424424312 Sep 5 0.0078623088 1.380286 -0.0111485788 Oct 5 0.0080334052 1.369261 -0.0066940445 Nov 5 0.0008431103 1.358235 -0.0034781188 Dec 5 -0.0080050421 1.344454 -0.0185489878 Jan 6 -0.0145136793 1.330673 -0.0256593722 Feb 6 -0.0209253713 1.318027 0.0252982908 Mar 6 0.0018129774 1.305381 0.0129059131 Apr 6 0.0163998505 1.293285 0.0065155290 May 6 -0.0010966056 1.281188 -0.0011915257 Jun 6 -0.0049800907 1.269199 -0.0116184654 Jul 6 0.0093864271 1.257209 -0.0377954080 Aug 6 0.0051827113 1.245266 -0.0104486316 Sep 6 0.0078623088 1.233323 0.0444148317 > m$win s t l 691 19 13 > m$deg s t l 0 1 1 > m$jump s t l 70 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/fisher/rcomp/tmp/1ydpe1353791694.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/2pug61353791694.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/377md1353791694.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/40fmn1353791694.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/5gi3x1353791694.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/6v6r11353791694.tab") > > try(system("convert tmp/1ydpe1353791694.ps tmp/1ydpe1353791694.png",intern=TRUE)) character(0) > try(system("convert tmp/2pug61353791694.ps tmp/2pug61353791694.png",intern=TRUE)) character(0) > try(system("convert tmp/377md1353791694.ps tmp/377md1353791694.png",intern=TRUE)) character(0) > try(system("convert tmp/40fmn1353791694.ps tmp/40fmn1353791694.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.332 0.580 2.899