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(462,455,461,461,463,462,456,455,456,472,472,471,465,459,465,468,467,463,460,462,461,476,476,471,453,443,442,444,438,427,424,416,406,431,434,418,412,404,409,412,406,398,397,385,390,413,413,401,397,397,409,419,424,428,430,424,433,456,459,446,441) > 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 -2.847716 461.7282 3.11953567 Feb 1 -7.336247 461.8338 0.50241227 Mar 1 -1.339862 461.9395 0.40037231 Apr 1 2.519089 462.0784 -3.59745150 May 1 1.578036 462.2172 -0.79527245 Jun 1 -2.148603 462.3828 1.76584689 Jul 1 -4.075237 462.5483 -2.47303849 Aug 1 -8.889010 462.7541 1.13494221 Sep 1 -7.902787 462.9599 0.94292591 Oct 1 12.514756 463.3268 -3.84155875 Nov 1 13.732297 463.6937 -5.42604216 Dec 1 4.195284 464.0551 2.74963918 Jan 2 -2.847716 464.4164 3.43130783 Feb 2 -7.336247 464.8447 1.49153029 Mar 2 -1.339862 465.2730 1.06683619 Apr 2 2.519089 465.5720 -0.09113808 May 2 1.578036 465.8711 -0.44910949 Jun 2 -2.148603 465.6383 -0.48969974 Jul 2 -4.075237 465.4055 -1.33029471 Aug 2 -8.889010 464.2771 6.61189638 Sep 2 -7.902787 463.1487 5.75409047 Oct 2 12.514756 461.1077 2.37754260 Nov 2 13.732297 459.0667 3.20099598 Dec 2 4.195284 456.0735 10.73118073 Jan 3 -2.847716 453.0804 2.76735277 Feb 3 -7.336247 449.2441 1.09213236 Mar 3 -1.339862 445.4079 -2.06800461 Apr 3 2.519089 441.2795 0.20140245 May 3 1.578036 437.1512 -0.72918763 Jun 3 -2.148603 433.3160 -4.16739847 Jul 3 -4.075237 429.4809 -1.40561404 Aug 3 -8.889010 426.2796 -1.39054282 Sep 3 -7.902787 423.0783 -9.17546861 Oct 3 12.514756 420.4352 -1.94994683 Nov 3 13.732297 417.7921 2.47557620 Dec 3 4.195284 415.4781 -1.67342581 Jan 4 -2.847716 413.1642 1.68355948 Feb 4 -7.336247 411.0956 0.24069520 Mar 4 -1.339862 409.0269 1.31291437 Apr 4 2.519089 407.2484 2.23252131 May 4 1.578036 405.4698 -1.04786889 Jun 4 -2.148603 404.0230 -3.87438454 Jul 4 -4.075237 402.5761 -1.50090492 Aug 4 -8.889010 401.9280 -8.03900384 Sep 4 -7.902787 401.2799 -3.37709978 Oct 4 12.514756 401.9525 -1.46723677 Nov 4 13.732297 402.6251 -3.35737251 Dec 4 4.195284 404.8113 -8.00654355 Jan 5 -2.847716 406.9974 -7.14972728 Feb 5 -7.336247 410.2808 -5.94458090 Mar 5 -1.339862 413.5642 -3.22435106 Apr 5 2.519089 417.4255 -0.94461187 May 5 1.578036 421.2868 1.13513017 Jun 5 -2.148603 424.9849 5.16374903 Jul 5 -4.075237 428.6829 5.39236315 Aug 5 -8.889010 432.3890 0.50003608 Sep 5 -7.902787 436.0951 4.80771199 Oct 5 12.514756 439.7816 3.70365900 Nov 5 13.732297 443.4681 1.79960726 Dec 5 4.195284 447.0723 -5.26756394 Jan 6 -2.847716 450.6765 -6.82874783 > m$win s t l 611 19 13 > m$deg s t l 0 1 1 > m$jump s t l 62 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1vqr11259943280.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/213qf1259943280.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/38kj11259943280.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/44zo01259943280.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/5tiiv1259943280.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/6ee9g1259943280.tab") > system("convert tmp/1vqr11259943280.ps tmp/1vqr11259943280.png") > system("convert tmp/213qf1259943280.ps tmp/213qf1259943280.png") > system("convert tmp/38kj11259943280.ps tmp/38kj11259943280.png") > system("convert tmp/44zo01259943280.ps tmp/44zo01259943280.png") > > > proc.time() user system elapsed 0.973 0.603 1.130