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(325412,326011,328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,310631,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,300713,287224) > 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 22528.704 313823.0 -10939.66142 Feb 1 14011.088 314265.7 -2265.82480 Mar 1 6214.732 314708.5 7358.75236 Apr 1 -3058.852 315120.5 5418.35596 May 1 -2112.238 315532.5 4118.75998 Jun 1 -1686.630 315952.3 -528.66847 Jul 1 -4694.026 316372.1 597.90565 Aug 1 -9363.873 316732.0 2022.90533 Sep 1 -12359.317 317091.8 -1782.49765 Oct 1 -17076.617 317024.1 368.56444 Nov 1 -10639.316 316956.3 -2281.97338 Dec 1 18236.349 316804.2 -1564.56406 Jan 2 22528.704 316652.1 -1482.84462 Feb 2 14011.088 316412.5 5508.44570 Mar 2 6214.732 316172.8 1543.47656 Apr 2 -3058.852 316014.2 971.60878 May 2 -2112.238 315855.7 741.54141 Jun 2 -1686.630 315635.4 -730.79606 Jul 2 -4694.026 315415.2 -1057.13094 Aug 2 -9363.873 314773.3 -2446.41623 Sep 2 -12359.317 314131.4 -2783.10417 Oct 2 -17076.617 312860.1 2639.48137 Nov 2 -10639.316 311588.8 9681.46699 Dec 2 18236.349 309741.0 1787.61557 Jan 3 22528.704 307893.2 4661.07428 Feb 3 14011.088 305481.0 8123.92822 Mar 3 6214.732 303068.7 -164.47730 Apr 3 -3058.852 300069.0 -1094.18781 May 3 -2112.238 297069.3 -3544.09789 Jun 3 -1686.630 293923.9 -695.25333 Jul 3 -4694.026 290778.4 -1406.40619 Aug 3 -9363.873 287932.3 -2093.42693 Sep 3 -12359.317 285086.2 -160.85032 Oct 3 -17076.617 282692.4 -634.75685 Nov 3 -10639.316 280298.6 -6369.26330 Dec 3 18236.349 278302.5 267.18037 Jan 4 22528.704 276306.4 4762.93417 Feb 4 14011.088 274599.6 -1616.69331 Mar 4 6214.732 272892.8 -2680.58025 Apr 4 -3058.852 271366.3 -1883.47336 May 4 -2112.238 269839.8 -574.56606 Jun 4 -1686.630 268470.3 1597.34962 Jul 4 -4694.026 267100.8 115.26787 Aug 4 -9363.873 265828.2 -922.35458 Sep 4 -12359.317 264555.7 961.62032 Oct 4 -17076.617 263597.4 -2717.74260 Nov 4 -10639.316 262639.0 -1258.70542 Dec 4 18236.349 262258.6 -49.94076 Jan 5 22528.704 261878.2 850.13401 Feb 5 14011.088 262306.2 -5341.25516 Mar 5 6214.732 262734.2 -7872.90379 Apr 5 -3058.852 263765.0 -5103.15804 May 5 -2112.238 264795.8 -2307.61188 Jun 5 -1686.630 266307.1 -717.51395 Jul 5 -4694.026 267818.4 1166.58656 Aug 5 -9363.873 269304.3 3335.61248 Sep 5 -12359.317 270790.1 4141.23574 Oct 5 -17076.617 272327.0 916.58709 Nov 5 -10639.316 273864.0 996.33853 Dec 5 18236.349 275410.7 212.92440 Jan 6 22528.704 276957.5 1226.82039 Feb 6 14011.088 278485.5 -5272.62293 > m$win s t l 621 19 13 > m$deg s t l 0 1 1 > m$jump s t l 63 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1t91y1259689607.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/2ics11259689607.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/3fbh81259689607.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/4ls731259689607.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/5upy41259689607.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/6sbra1259689607.tab") > system("convert tmp/1t91y1259689607.ps tmp/1t91y1259689607.png") > system("convert tmp/2ics11259689607.ps tmp/2ics11259689607.png") > system("convert tmp/3fbh81259689607.ps tmp/3fbh81259689607.png") > system("convert tmp/4ls731259689607.ps tmp/4ls731259689607.png") > > > proc.time() user system elapsed 0.963 0.609 1.368