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(631923,654294,671833,586840,600969,625568,558110,630577,628654,603184,656255,600730,670326,678423,641502,625311,628177,589767,582471,636248,599885,621694,637406,595994,696308,674201,648861,649605,672392,598396,613177,638104,615632,634465,638686,604243,706669,677185,644328,644825,605707,600136,612166,599659,634210,618234,613576,627200,668973,651479,619661,644260,579936,601752,595376,588902,634341,594305,606200,610926,633685,639696,659451,593248,606677,599434,569578,629873,613438,604172,658328,612633,707372,739770,777535,685030,730234,714154,630872,719492,677023,679272,718317,645672) > 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 42765.588 605046.4 -15888.97962 Feb 1 41422.349 607771.1 5100.52284 Mar 1 32697.821 610495.9 28639.31451 Apr 1 -1346.464 613106.8 -24920.35311 May 1 -2672.970 615717.8 -12075.79923 Jun 1 -17022.968 618141.8 24449.19821 Jul 1 -41740.342 620565.8 -20715.42921 Aug 1 -2797.382 622740.2 10634.16233 Sep 1 -9679.644 624914.7 13418.97696 Oct 1 -17977.662 626239.4 -5077.74078 Nov 1 5338.441 627564.1 23352.42001 Dec 1 -28986.777 627737.7 1979.05721 Jan 2 42765.588 627911.3 -350.88998 Feb 2 41422.349 627443.9 9556.74909 Mar 2 32697.821 626976.5 -18172.32261 Apr 2 -1346.464 626443.0 214.46843 May 2 -2672.970 625909.5 4940.48097 Jun 2 -17022.968 626098.1 -19308.14590 Jul 2 -41740.342 626286.7 -2075.39763 Aug 2 -2797.382 627214.8 11830.58999 Sep 2 -9679.644 628142.8 -18578.19932 Oct 2 -17977.662 629912.6 9759.08903 Nov 2 5338.441 631682.3 385.25589 Dec 2 -28986.777 633604.3 -8623.48329 Jan 3 42765.588 635526.2 18016.19314 Feb 3 41422.349 636925.8 -4147.11649 Mar 3 32697.821 638325.3 -22162.13690 Apr 3 -1346.464 639094.3 11857.21138 May 3 -2672.970 639863.2 35201.78117 Jun 3 -17022.968 640415.0 -24996.04258 Jul 3 -41740.342 640966.8 13950.50881 Aug 3 -2797.382 640884.6 16.80415 Sep 3 -9679.644 640802.3 -15490.67744 Oct 3 -17977.662 639605.4 12837.27303 Nov 3 5338.441 638408.5 -5060.89798 Dec 3 -28986.777 636799.0 -3569.24116 Jan 4 42765.588 635189.6 28713.83129 Feb 4 41422.349 634053.8 1708.80418 Mar 4 32697.821 632918.1 -21287.93371 Apr 4 -1346.464 631931.0 14240.48226 May 4 -2672.970 630943.9 -22563.88027 Jun 4 -17022.968 630033.6 -12874.60247 Jul 4 -41740.342 629123.3 24783.05047 Aug 4 -2797.382 627959.1 -25502.70272 Sep 4 -9679.644 626794.9 17094.76717 Oct 4 -17977.662 625579.7 10631.94291 Nov 4 5338.441 624364.6 -16127.00284 Dec 4 -28986.777 623089.9 33096.90106 Jan 5 42765.588 621815.2 4392.22059 Feb 5 41422.349 620626.1 -10569.43062 Mar 5 32697.821 619437.0 -32473.79260 Apr 5 -1346.464 618323.0 27283.43454 May 5 -2672.970 617209.1 -34600.11681 Jun 5 -17022.968 616245.4 2529.54063 Jul 5 -41740.342 615281.8 21834.57322 Aug 5 -2797.382 614765.6 -23066.17997 Sep 5 -9679.644 614249.4 29771.28992 Oct 5 -17977.662 613852.7 -1570.05157 Nov 5 5338.441 613456.1 -12594.51455 Dec 5 -28986.777 613047.0 26865.72820 Jan 6 42765.588 612638.0 -21718.61343 Feb 6 41422.349 612698.8 -14425.11435 Mar 6 32697.821 612759.5 13993.67394 Apr 6 -1346.464 614080.6 -19486.12375 May 6 -2672.970 615401.7 -6051.69995 Jun 6 -17022.968 618912.9 -2455.91295 Jul 6 -41740.342 622424.1 -11105.75082 Aug 6 -2797.382 629283.1 3387.31534 Sep 6 -9679.644 636142.0 -13024.39543 Oct 6 -17977.662 645255.5 -23105.80900 Nov 6 5338.441 654368.9 -1379.34406 Dec 6 -28986.777 663493.0 -21873.21202 Jan 7 42765.588 672617.1 -8010.66436 Feb 7 41422.349 680116.8 18230.88189 Mar 7 32697.821 687616.5 57220.71736 Apr 7 -1346.464 690718.5 -4342.01439 May 7 -2672.970 693820.5 39086.47536 Jun 7 -17022.968 696355.1 34821.88395 Jul 7 -41740.342 698889.7 -26277.33231 Aug 7 -2797.382 700834.0 21455.42986 Sep 7 -9679.644 702778.2 -16075.58490 Oct 7 -17977.662 704048.8 -6799.10942 Nov 7 5338.441 705319.3 7659.24457 Dec 7 -28986.777 706109.7 -31450.88551 > m$win s t l 841 19 13 > m$deg s t l 0 1 1 > m$jump s t l 85 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1875d1292792886.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/2875d1292792886.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/3tqpb1292792887.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/4tqpb1292792887.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/5pim21292792887.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/6bj3q1292792887.tab") > > try(system("convert tmp/1875d1292792886.ps tmp/1875d1292792886.png",intern=TRUE)) character(0) > try(system("convert tmp/2875d1292792886.ps tmp/2875d1292792886.png",intern=TRUE)) character(0) > try(system("convert tmp/3tqpb1292792887.ps tmp/3tqpb1292792887.png",intern=TRUE)) character(0) > try(system("convert tmp/4tqpb1292792887.ps tmp/4tqpb1292792887.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.064 0.672 3.879