R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(7.55,7.55,7.59,7.59,7.59,7.57,7.57,7.59,7.6,7.64,7.64,7.76,7.76,7.76,7.77,7.83,7.94,7.94,7.94,8.09,8.18,8.26,8.28,8.28,8.28,8.29,8.3,8.3,8.31,8.33,8.33,8.34,8.48,8.59,8.67,8.67,8.67,8.71,8.72,8.72,8.72,8.74,8.74,8.74,8.74,8.79,8.85,8.86,8.87,8.92,8.96,8.97,8.99,8.98,8.98,9.01,9.01,9.03,9.05,9.05) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > #'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 -0.003670289 7.550017 0.003653246 Feb 1 -0.009277355 7.560610 -0.001332451 Mar 1 -0.012884432 7.571203 0.031681863 Apr 1 -0.019128019 7.582811 0.026317038 May 1 -0.011371599 7.594419 0.006952206 Jun 1 -0.027821980 7.607255 -0.009432790 Jul 1 -0.046272376 7.620090 -0.003817770 Aug 1 -0.023682949 7.633789 -0.020106067 Sep 1 0.004906515 7.647488 -0.052394400 Oct 1 0.041401679 7.666381 -0.067782430 Nov 1 0.053896840 7.685274 -0.099170455 Dec 1 0.053903933 7.716282 -0.010185522 Jan 2 -0.003670289 7.747290 0.016380727 Feb 2 -0.009277355 7.789084 -0.019806381 Mar 2 -0.012884432 7.830878 -0.047993479 Apr 2 -0.019128019 7.879781 -0.030653104 May 2 -0.011371599 7.928684 0.022687264 Jun 2 -0.027821980 7.977261 -0.009438661 Jul 2 -0.046272376 8.025837 -0.039564570 Aug 2 -0.023682949 8.070346 0.043337216 Sep 2 0.004906515 8.114855 0.060238966 Oct 2 0.041401679 8.153531 0.065067641 Nov 2 0.053896840 8.192207 0.033896319 Dec 2 0.053903933 8.222861 0.003235379 Jan 3 -0.003670289 8.253515 0.030155755 Feb 3 -0.009277355 8.278690 0.020587552 Mar 3 -0.012884432 8.303865 0.009019358 Apr 3 -0.019128019 8.330073 -0.010944974 May 3 -0.011371599 8.356281 -0.034909313 Jun 3 -0.027821980 8.387708 -0.029886087 Jul 3 -0.046272376 8.419135 -0.042862845 Aug 3 -0.023682949 8.454632 -0.090949201 Sep 3 0.004906515 8.490129 -0.015035593 Oct 3 0.041401679 8.527231 0.021367040 Nov 3 0.053896840 8.564333 0.051769678 Dec 3 0.053903933 8.599854 0.016242081 Jan 4 -0.003670289 8.635374 0.038295800 Feb 4 -0.009277355 8.663780 0.055497080 Mar 4 -0.012884432 8.692186 0.040698371 Apr 4 -0.019128019 8.710975 0.028152968 May 4 -0.011371599 8.729764 0.001607559 Jun 4 -0.027821980 8.744023 0.023798759 Jul 4 -0.046272376 8.758282 0.027989974 Aug 4 -0.023682949 8.774583 -0.010900210 Sep 4 0.004906515 8.790884 -0.055790431 Oct 4 0.041401679 8.811036 -0.062437728 Nov 4 0.053896840 8.831188 -0.035085022 Dec 4 0.053903933 8.854177 -0.048080835 Jan 5 -0.003670289 8.877166 -0.003495332 Feb 5 -0.009277355 8.900794 0.028483832 Mar 5 -0.012884432 8.924421 0.048463006 Apr 5 -0.019128019 8.939737 0.049391480 May 5 -0.011371599 8.955052 0.046319947 Jun 5 -0.027821980 8.969159 0.038663344 Jul 5 -0.046272376 8.983266 0.043006756 Aug 5 -0.023682949 8.996442 0.037241436 Sep 5 0.004906515 9.009617 -0.004523920 Oct 5 0.041401679 9.021356 -0.032758026 Nov 5 0.053896840 9.033095 -0.036992128 Dec 5 0.053903933 9.043639 -0.047542583 > 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/www/html/rcomp/tmp/1omed1260535638.ps",horizontal=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/www/html/rcomp/tmp/264fl1260535638.ps",horizontal=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/www/html/rcomp/tmp/34q8m1260535638.ps",horizontal=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/www/html/rcomp/tmp/41jnw1260535638.ps",horizontal=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/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/www/html/rcomp/tmp/5orwr1260535638.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/www/html/rcomp/tmp/6bl8a1260535638.tab") > system("convert tmp/1omed1260535638.ps tmp/1omed1260535638.png") > system("convert tmp/264fl1260535638.ps tmp/264fl1260535638.png") > system("convert tmp/34q8m1260535638.ps tmp/34q8m1260535638.png") > system("convert tmp/41jnw1260535638.ps tmp/41jnw1260535638.png") > > > proc.time() user system elapsed 0.944 0.608 1.190