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(274412,272433,268361,268586,264768,269974,304744,309365,308347,298427,289231,291975,294912,293488,290555,284736,281818,287854,316263,325412,326011,328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,301631,329765,335083,327616,309119,295916,291413,291542,284678,276475,272566,264981,263290,296806,303598,286994,276427,266424,267153,268381,262522,255542,253158,243803,250741,280445,285257,270976,261076,255603,260376,263903,264291,263276,262572,256167,264221,293860) > 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 -1596.321 275624.4 383.94791 Feb 1 -4697.680 277347.0 -216.31800 Mar 1 -9518.468 279069.6 -1190.15513 Apr 1 -12872.870 280782.1 676.79593 May 1 -17695.125 282494.5 -31.39969 Jun 1 -13276.256 284195.6 -945.32717 Jul 1 17163.044 285896.6 1684.31514 Aug 1 23370.793 287591.9 -1597.70239 Sep 1 16781.296 289287.2 2278.52531 Oct 1 7037.426 290896.9 492.71028 Nov 1 -2717.612 292506.5 -557.93771 Dec 1 -1978.227 293852.8 100.43963 Jan 2 -1596.321 295199.0 1309.29670 Feb 2 -4697.680 296575.6 1610.09657 Mar 2 -9518.468 297952.1 2121.32521 Apr 2 -12872.870 299777.5 -2168.63333 May 2 -17695.125 301602.9 -2089.73857 Jun 2 -13276.256 303636.0 -2505.72479 Jul 2 17163.044 305669.1 -6569.14122 Aug 2 23370.793 307547.4 -5506.20529 Sep 2 16781.296 309425.7 -196.02414 Oct 2 7037.426 311126.8 10117.72516 Nov 2 -2717.612 312828.0 7369.64148 Dec 2 -1978.227 314213.0 5304.26099 Jan 3 -1596.321 315598.0 -264.63977 Feb 3 -4697.680 316333.8 639.84921 Mar 3 -9518.468 317069.7 1839.76697 Apr 3 -12872.870 317127.9 -1305.02552 May 3 -17695.125 317186.1 825.03529 Jun 3 -13276.256 317013.3 298.00214 Jul 3 17163.044 316840.4 -527.46122 Aug 3 23370.793 316601.8 -2274.62491 Sep 3 16781.296 316363.2 2787.45664 Oct 3 7037.426 316058.7 834.86558 Nov 3 -2717.612 315754.2 890.44156 Dec 3 -1978.227 315458.2 1005.03025 Jan 4 -1596.321 315162.2 -347.90133 Feb 4 -4697.680 314700.0 -338.32880 Mar 4 -9518.468 314237.8 -1756.32750 Apr 4 -12872.870 313240.9 -1379.00456 May 4 -17695.125 312244.0 3874.17167 Jun 4 -13276.256 310644.0 4263.24310 Jul 4 17163.044 309044.1 3557.88431 Aug 4 23370.793 306920.3 4791.92546 Sep 4 16781.296 304796.5 6038.21183 Oct 4 7037.426 302193.0 -111.43842 Nov 4 -2717.612 299589.5 -955.92163 Dec 4 -1978.227 296654.2 -3262.93423 Jan 5 -1596.321 293718.8 -580.46710 Feb 5 -4697.680 290822.0 -1446.34761 Mar 5 -9518.468 287925.3 -1931.79935 Apr 5 -12872.870 285294.8 144.04717 May 5 -17695.125 282664.4 11.74700 Jun 5 -13276.256 280452.9 -3886.60126 Jul 5 17163.044 278241.3 1401.62028 Aug 5 23370.793 276362.9 3864.26610 Sep 5 16781.296 274484.5 -4271.84285 Oct 5 7037.426 272849.7 -3460.12393 Nov 5 -2717.612 271214.8 -2073.23798 Dec 5 -1978.227 269814.0 -682.79818 Jan 6 -1596.321 268413.2 1564.12134 Feb 6 -4697.680 267138.5 81.18596 Mar 6 -9518.468 265863.8 -803.32065 Apr 6 -12872.870 264729.1 1301.78952 May 6 -17695.125 263594.4 -2096.24700 Jun 6 -13276.256 262840.4 1176.86243 Jul 6 17163.044 262086.4 1195.54166 Aug 6 23370.793 262072.8 -186.56190 Sep 6 16781.296 262059.1 -7864.42022 Oct 6 7037.426 263090.5 -9051.90701 Nov 6 -2717.612 264121.8 -5801.22676 Dec 6 -1978.227 265598.7 -3244.48077 Jan 7 -1596.321 267075.6 -1576.25504 Feb 7 -4697.680 268640.5 348.20582 Mar 7 -9518.468 270205.4 2589.09547 Apr 7 -12872.870 271906.2 3538.65232 May 7 -17695.125 273607.1 255.06246 Jun 7 -13276.256 275416.1 2081.15600 Jul 7 17163.044 277225.1 -528.18067 > m$win s t l 791 19 13 > m$deg s t l 0 1 1 > m$jump s t l 80 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1dpk81259939572.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/2hyfq1259939572.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/3aekk1259939573.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/4fea21259939573.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/5b6k71259939573.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/6xdsv1259939573.tab") > system("convert tmp/1dpk81259939572.ps tmp/1dpk81259939572.png") > system("convert tmp/2hyfq1259939572.ps tmp/2hyfq1259939572.png") > system("convert tmp/3aekk1259939573.ps tmp/3aekk1259939573.png") > system("convert tmp/4fea21259939573.ps tmp/4fea21259939573.png") > > > proc.time() user system elapsed 0.993 0.588 1.174