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(267413,267366,264777,258863,254844,254868,277267,285351,286602,283042,276687,277915,277128,277103,275037,270150,267140,264993,287259,291186,292300,288186,281477,282656,280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663,250643,243422,247105,248541,245039,237080,237085,225554,226839,247934,248333,246969,245098,246263,255765,264319,268347,273046,273963,267430,271993,292710,295881,293299) > 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 2145.2554 263916.7 1351.0161 Feb 1 1151.0189 265177.1 1037.8939 Mar 1 -2556.3860 266437.4 895.9400 Apr 1 -5104.6274 267664.0 -3696.4040 May 1 -10971.0354 268890.6 -3075.5812 Jun 1 -13145.9044 270046.7 -2032.8445 Jul 1 7704.7309 271202.9 -1640.6121 Aug 1 10166.3014 272309.2 2875.4638 Sep 1 8414.7067 273415.6 4771.7048 Oct 1 3928.3515 274454.7 4658.9205 Nov 1 -1895.5990 275493.9 3088.7315 Dec 1 163.1840 276195.5 1556.2895 Jan 2 2145.2554 276897.2 -1914.4407 Feb 2 1151.0189 277373.2 -1421.2259 Mar 2 -2556.3860 277849.2 -255.8426 Apr 2 -5104.6274 278308.8 -3054.1433 May 2 -10971.0354 278768.3 -657.2773 Jun 2 -13145.9044 279246.5 -1107.6436 Jul 2 7704.7309 279724.8 -170.5142 Aug 2 10166.3014 280097.7 922.0001 Sep 2 8414.7067 280470.6 3414.6795 Oct 2 3928.3515 280796.0 3461.6238 Nov 2 -1895.5990 281121.4 2251.1634 Dec 2 163.1840 281381.2 1111.6278 Jan 3 2145.2554 281640.9 -3596.1962 Feb 3 1151.0189 281643.9 -2386.9177 Mar 3 -2556.3860 281646.9 -2254.4709 Apr 3 -5104.6274 281193.7 -873.1021 May 3 -10971.0354 280740.6 4582.4333 Jun 3 -13145.9044 279806.0 4650.8955 Jul 3 7704.7309 278871.4 3225.8533 Aug 3 10166.3014 277369.3 3190.3838 Sep 3 8414.7067 275867.2 8018.0793 Oct 3 3928.3515 273705.1 872.5353 Nov 3 -1895.5990 271543.0 178.5865 Dec 3 163.1840 268868.4 -3170.5724 Jan 4 2145.2554 266193.8 694.9803 Feb 4 1151.0189 263466.0 -441.0161 Mar 4 -2556.3860 260738.2 -2983.8442 Apr 4 -5104.6274 258328.0 129.6604 May 4 -10971.0354 255917.7 1110.3317 Jun 4 -13145.9044 254031.3 -5513.4211 Jul 4 7704.7309 252144.9 -1293.6783 Aug 4 10166.3014 250588.9 237.8156 Sep 4 8414.7067 249032.8 -2784.5255 Oct 4 3928.3515 247698.2 -983.5566 Nov 4 -1895.5990 246363.6 -1045.9923 Dec 4 163.1840 245267.5 1674.3510 Jan 5 2145.2554 244171.3 2224.4060 Feb 5 1151.0189 243316.7 571.2529 Mar 5 -2556.3860 242462.1 -2825.7319 Apr 5 -5104.6274 242072.4 117.2243 May 5 -10971.0354 241682.7 -5157.6527 Jun 5 -13145.9044 242268.8 -2283.8464 Jul 5 7704.7309 242854.8 -2625.5445 Aug 5 10166.3014 244820.2 -6653.5368 Sep 5 8414.7067 246785.7 -8231.3641 Oct 5 3928.3515 249986.6 -8816.9720 Nov 5 -1895.5990 253187.6 -5028.9847 Dec 5 163.1840 257169.8 -1567.9553 Jan 6 2145.2554 261152.0 1021.7858 Feb 6 1151.0189 265080.0 2115.9926 Mar 6 -2556.3860 269008.0 6594.3677 Apr 6 -5104.6274 272972.4 6095.2751 May 6 -10971.0354 276936.7 1464.3491 Jun 6 -13145.9044 280900.3 4238.6494 Jul 6 7704.7309 284863.8 141.4452 Aug 6 10166.3014 288753.3 -3038.6187 Sep 6 8414.7067 292642.8 -7758.5175 > m$win s t l 691 19 13 > m$deg s t l 0 1 1 > m$jump s t l 70 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/19pn31259945620.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/2kzgg1259945620.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/3o4zc1259945620.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/4n7px1259945620.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/5544s1259945620.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/654og1259945620.tab") > system("convert tmp/19pn31259945620.ps tmp/19pn31259945620.png") > system("convert tmp/2kzgg1259945620.ps tmp/2kzgg1259945620.png") > system("convert tmp/3o4zc1259945620.ps tmp/3o4zc1259945620.png") > system("convert tmp/4n7px1259945620.ps tmp/4n7px1259945620.png") > > > proc.time() user system elapsed 1.000 0.609 1.187