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.3,7.6,7.5,7.6,7.9,7.9,8.1,8.2,8,7.5,6.8,6.5,6.6,7.6,8,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5) > 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.40998337 7.822346 -0.112362174 Feb 1 0.01797253 7.789033 -0.207005476 Mar 1 0.03625113 7.755720 -0.291971475 Apr 1 0.00546667 7.718518 -0.123984621 May 1 -0.10865107 7.681316 0.327335515 Jun 1 -0.19704022 7.645888 0.451152140 Jul 1 0.01457047 7.610461 0.474968916 Aug 1 0.30914933 7.583763 0.307087634 Sep 1 0.37039492 7.557065 0.072539619 Oct 1 0.22037539 7.539057 -0.259432878 Nov 1 -0.01297728 7.521050 -0.708072244 Dec 1 -0.24552840 7.508511 -0.762982354 Jan 2 -0.40998337 7.495972 -0.485988605 Feb 2 0.01797253 7.497188 0.084839783 Mar 2 0.03625113 7.498403 0.465345474 Apr 2 0.00546667 7.530727 0.563806557 May 2 -0.10865107 7.563050 0.245600923 Jun 2 -0.19704022 7.596441 0.100598885 Jul 2 0.01457047 7.629833 -0.044403002 Aug 2 0.30914933 7.623985 -0.133134049 Sep 2 0.37039492 7.618137 -0.188531829 Oct 2 0.22037539 7.599492 -0.019867271 Nov 2 -0.01297728 7.580847 -0.067869581 Dec 2 -0.24552840 7.589604 0.155924260 Jan 3 -0.40998337 7.598361 -0.088378040 Feb 3 0.01797253 7.626781 -0.144754022 Mar 3 0.03625113 7.655202 -0.191452699 Apr 3 0.00546667 7.693503 -0.098969400 May 3 -0.10865107 7.731804 0.076847182 Jun 3 -0.19704022 7.763206 0.133834446 Jul 3 0.01457047 7.794608 0.090821861 Aug 3 0.30914933 7.777535 0.013315945 Sep 3 0.37039492 7.760462 0.069143296 Oct 3 0.22037539 7.692955 0.286669901 Nov 3 -0.01297728 7.625448 0.587529636 Dec 3 -0.24552840 7.540975 0.604553505 Jan 4 -0.40998337 7.456502 0.253481232 Feb 4 0.01797253 7.362925 -0.480897870 Mar 4 0.03625113 7.269349 -0.705599668 Apr 4 0.00546667 7.171051 -0.476517974 May 4 -0.10865107 7.072754 -0.064102997 Jun 4 -0.19704022 7.003872 0.193168611 Jul 4 0.01457047 6.934989 0.150440370 Aug 4 0.30914933 6.905712 -0.014861049 Sep 4 0.37039492 6.876434 -0.146829200 Oct 4 0.22037539 6.844642 -0.165017063 Nov 4 -0.01297728 6.812849 0.200128205 Dec 4 -0.24552840 6.763964 0.281564415 Jan 5 -0.40998337 6.715079 0.094904484 Feb 5 0.01797253 6.669622 0.012405109 Mar 5 0.03625113 6.624166 -0.060416962 Apr 5 0.00546667 6.572758 -0.178224920 May 5 -0.10865107 6.521351 -0.112699596 Jun 5 -0.19704022 6.475346 -0.078306058 Jul 5 0.01457047 6.429342 0.056087632 Aug 5 0.30914933 6.433742 0.057108621 Sep 5 0.37039492 6.438142 -0.008537122 Oct 5 0.22037539 6.463691 -0.284066499 Nov 5 -0.01297728 6.489240 -0.376262746 Dec 5 -0.24552840 6.496257 -0.450728416 Jan 6 -0.40998337 6.503274 0.006709773 Feb 6 0.01797253 6.531849 0.650178028 Mar 6 0.03625113 6.560425 0.703323587 Apr 6 0.00546667 6.656216 0.238316916 May 6 -0.10865107 6.752008 -0.543356473 Jun 6 -0.19704022 6.867886 -0.870845418 Jul 6 0.01457047 6.983764 -0.798334212 Aug 6 0.30914933 7.095414 -0.304563549 Sep 6 0.37039492 7.207065 0.122540382 Oct 6 0.22037539 7.324994 0.354630296 Nov 6 -0.01297728 7.442924 0.270053340 Dec 6 -0.24552840 7.570534 0.074994624 Jan 7 -0.40998337 7.698144 0.211839766 > m$win s t l 731 19 13 > m$deg s t l 0 1 1 > m$jump s t l 74 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1f50l1259954670.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/2t81b1259954670.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/3axw31259954670.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/4o4mh1259954670.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/514zh1259954670.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/6dg421259954670.tab") > system("convert tmp/1f50l1259954670.ps tmp/1f50l1259954670.png") > system("convert tmp/2t81b1259954670.ps tmp/2t81b1259954670.png") > system("convert tmp/3axw31259954670.ps tmp/3axw31259954670.png") > system("convert tmp/4o4mh1259954670.ps tmp/4o4mh1259954670.png") > > > proc.time() user system elapsed 0.999 0.621 1.171