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(9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3) > 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.31297669 8.806445 0.180578706 Feb 1 0.19406974 8.753188 0.352742704 Mar 1 -0.08575170 8.699931 0.085821196 Apr 1 -0.27032512 8.652639 -0.182314322 May 1 -0.11489877 8.605348 -0.190449616 Jun 1 0.17552457 8.561811 -0.237335664 Jul 1 0.22594798 8.518274 -0.144221774 Aug 1 0.11983726 8.477152 -0.096989449 Sep 1 -0.06627329 8.436031 -0.169757285 Oct 1 -0.31313982 8.426624 -0.013484133 Nov 1 -0.40000642 8.417217 -0.117210906 Dec 1 0.22203902 8.435014 -0.057053113 Jan 2 0.31297669 8.452811 -0.065787559 Feb 2 0.19406974 8.470574 0.035356648 Mar 2 -0.08575170 8.488336 0.097415349 Apr 2 -0.27032512 8.498677 0.171647686 May 2 -0.11489877 8.509019 0.105880247 Jun 2 0.17552457 8.489741 0.034734389 Jul 2 0.22594798 8.470464 0.003588468 Aug 2 0.11983726 8.423769 0.056393747 Sep 2 -0.06627329 8.377074 0.189198864 Oct 2 -0.31313982 8.322853 0.290286831 Nov 2 -0.40000642 8.268632 0.131374873 Dec 2 0.22203902 8.211369 -0.233408163 Jan 3 0.31297669 8.154107 -0.367083438 Feb 3 0.19406974 8.098421 -0.192490606 Mar 3 -0.08575170 8.042735 0.043016719 Apr 3 -0.27032512 7.994935 0.175390064 May 3 -0.11489877 7.947135 0.067763634 Jun 3 0.17552457 7.891889 -0.067413450 Jul 3 0.22594798 7.836643 -0.062590596 Aug 3 0.11983726 7.758877 0.021286005 Sep 3 -0.06627329 7.681111 0.385162443 Oct 3 -0.31313982 7.599053 0.414086842 Nov 3 -0.40000642 7.516995 0.083011315 Dec 3 0.22203902 7.438839 -0.160878272 Jan 4 0.31297669 7.360683 -0.373660099 Feb 4 0.19406974 7.266726 -0.460796046 Mar 4 -0.08575170 7.172769 -0.087017499 Apr 4 -0.27032512 7.089208 0.181116690 May 4 -0.11489877 7.005648 0.309251103 Jun 4 0.17552457 6.985443 0.139032475 Jul 4 0.22594798 6.965238 -0.091186215 Aug 4 0.11983726 6.976471 -0.296308715 Sep 4 -0.06627329 6.987705 -0.521431378 Oct 4 -0.31313982 6.992744 -0.579604133 Nov 4 -0.40000642 6.997783 -0.097776814 Dec 4 0.22203902 7.034581 0.443379697 Jan 5 0.31297669 7.071379 0.515643970 Feb 5 0.19406974 7.153770 0.152160479 Mar 5 -0.08575170 7.236160 -0.250408519 Apr 5 -0.27032512 7.315562 -0.445236816 May 5 -0.11489877 7.394964 -0.380064889 Jun 5 0.17552457 7.464866 0.059609694 Jul 5 0.22594798 7.534768 0.239284215 Aug 5 0.11983726 7.607393 0.272769654 Sep 5 -0.06627329 7.680018 0.086254931 Oct 5 -0.31313982 7.754722 -0.141582311 Nov 5 -0.40000642 7.829426 -0.029419480 Dec 5 0.22203902 7.904741 -0.026779844 Jan 6 0.31297669 7.980056 0.006967553 > 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/10q5s1259940905.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/2mhi71259940905.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/3ikya1259940905.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/41np41259940905.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/50orf1259940905.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/6z40w1259940905.tab") > system("convert tmp/10q5s1259940905.ps tmp/10q5s1259940905.png") > system("convert tmp/2mhi71259940905.ps tmp/2mhi71259940905.png") > system("convert tmp/3ikya1259940905.ps tmp/3ikya1259940905.png") > system("convert tmp/41np41259940905.ps tmp/41np41259940905.png") > > > proc.time() user system elapsed 0.968 0.600 1.134