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(1.5,1.6,1.8,1.5,1.3,1.6,1.6,1.8,1.8,1.6,1.8,2,1.3,1.1,1,1.2,1.2,1.3,1.3,1.4,1.1,0.9,1,1.1,1.4,1.5,1.8,1.8,1.8,1.7,1.5,1.1,1.3,1.6,1.9,1.9,2,2.2,2.2,2,2.3,2.6,3.2,3.2,3.1,2.8,2.3,1.9,1.9,2,2,1.8,1.6,1.4,0.2,0.3,0.4,0.7,1,1.1) > 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.086534406 1.6106548 -0.024120382 Feb 1 -0.009412461 1.6127600 -0.003347528 Mar 1 0.087709524 1.6148652 0.097425287 Apr 1 -0.002073935 1.6133480 -0.111274109 May 1 -0.011857380 1.6118309 -0.299973519 Jun 1 0.082084000 1.6047337 -0.086817660 Jul 1 -0.063974279 1.5976364 0.066337859 Aug 1 -0.047333266 1.5863005 0.261032784 Sep 1 -0.050692110 1.5749645 0.275727566 Oct 1 -0.047089857 1.5518888 0.095201048 Nov 1 0.056512304 1.5288131 0.214674621 Dec 1 0.092661780 1.4909068 0.416431418 Jan 2 -0.086534406 1.4530005 -0.066466122 Feb 2 -0.009412461 1.4066387 -0.297226206 Mar 2 0.087709524 1.3602768 -0.447986329 Apr 2 -0.002073935 1.3078462 -0.105772241 May 2 -0.011857380 1.2554155 -0.043558166 Jun 2 0.082084000 1.2247000 -0.006783963 Jul 2 -0.063974279 1.1939844 0.169989900 Aug 2 -0.047333266 1.2103617 0.236971533 Sep 2 -0.050692110 1.2267391 -0.076046978 Oct 2 -0.047089857 1.2697345 -0.322644612 Nov 2 0.056512304 1.3127299 -0.369242155 Dec 2 0.092661780 1.3500069 -0.342668632 Jan 3 -0.086534406 1.3872839 0.099250552 Feb 3 -0.009412461 1.4164379 0.092974538 Mar 3 0.087709524 1.4455920 0.266698486 Apr 3 -0.002073935 1.4855828 0.316491107 May 3 -0.011857380 1.5255737 0.286283715 Jun 3 0.082084000 1.5715446 0.046371363 Jul 3 -0.063974279 1.6175156 -0.053541328 Aug 3 -0.047333266 1.6577251 -0.510391858 Sep 3 -0.050692110 1.6979346 -0.347242532 Oct 3 -0.047089857 1.7450675 -0.097977629 Nov 3 0.056512304 1.7922003 0.051287365 Dec 3 0.092661780 1.8837602 -0.076422024 Jan 4 -0.086534406 1.9753202 0.111214248 Feb 4 -0.009412461 2.1084941 0.100918314 Mar 4 0.087709524 2.2416681 -0.129377660 Apr 4 -0.002073935 2.3467218 -0.344647843 May 4 -0.011857380 2.4517754 -0.139918038 Jun 4 0.082084000 2.4883293 0.029586656 Jul 4 -0.063974279 2.5248833 0.739091010 Aug 4 -0.047333266 2.5130783 0.734255009 Sep 4 -0.050692110 2.5012732 0.649418865 Oct 4 -0.047089857 2.4437339 0.403355986 Nov 4 0.056512304 2.3861945 -0.142706800 Dec 4 0.092661780 2.2444254 -0.437087206 Jan 5 -0.086534406 2.1026564 -0.116121949 Feb 5 -0.009412461 1.8991186 0.110293877 Mar 5 0.087709524 1.6955808 0.216709665 Apr 5 -0.002073935 1.5398136 0.262260369 May 5 -0.011857380 1.3840463 0.227811060 Jun 5 0.082084000 1.2473424 0.070573562 Jul 5 -0.063974279 1.1106386 -0.846664275 Aug 5 -0.047333266 0.9723002 -0.624966947 Sep 5 -0.050692110 0.8339619 -0.383269764 Oct 5 -0.047089857 0.6973432 0.049746637 Nov 5 0.056512304 0.5607246 0.382763129 Dec 5 0.092661780 0.4291964 0.578141827 > 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/10os61293388362.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/www/html/rcomp/tmp/2tyar1293388362.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/www/html/rcomp/tmp/3tyar1293388362.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/www/html/rcomp/tmp/4l79c1293388362.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/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/5iy731293388362.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/63z5r1293388362.tab") > > try(system("convert tmp/10os61293388362.ps tmp/10os61293388362.png",intern=TRUE)) character(0) > try(system("convert tmp/2tyar1293388362.ps tmp/2tyar1293388362.png",intern=TRUE)) character(0) > try(system("convert tmp/3tyar1293388362.ps tmp/3tyar1293388362.png",intern=TRUE)) character(0) > try(system("convert tmp/4l79c1293388362.ps tmp/4l79c1293388362.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.956 0.607 2.144