R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(283495,279998,287224,296369,300653,302686,277891,277537,285383,292213,298522,300431,297584,286445,288576,293299,295881,292710,271993,267430,273963,273046,268347,264319,255765,246263,245098,246969,248333,247934,226839,225554,237085,237080,245039,248541,247105,243422,250643,254663,260993,258556,235372,246057,253353,255198,264176,269034,265861,269826,278506,292300,290726,289802,271311,274352,275216,276836,280408,280190) > 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 492.7436 285320.5 -2318.21096 Feb 1 -4272.5698 286167.2 -1896.66189 Mar 1 551.9182 287014.0 -341.91413 Apr 1 7452.7139 287811.3 1104.97301 May 1 10240.1149 288608.6 1804.25497 Jun 1 9362.9436 289362.0 3961.10055 Jul 1 -12191.0265 290115.3 -33.25505 Aug 1 -10757.5752 290800.7 -2506.08167 Sep 1 -4014.9211 291486.0 -2088.11106 Oct 1 -2240.2234 291640.9 2812.27552 Nov 1 2083.6765 291795.9 4642.45996 Dec 1 3292.1997 291253.9 5884.86050 Jan 2 492.7436 290712.0 6379.24035 Feb 2 -4272.5698 289708.2 1009.41887 Mar 2 551.9182 288704.3 -680.20390 Apr 2 7452.7139 286893.3 -1046.96967 May 2 10240.1149 285082.2 558.65938 Jun 2 9362.9436 282358.7 988.35266 Jul 2 -12191.0265 279635.2 4548.84476 Aug 2 -10757.5752 276252.0 1935.55981 Sep 2 -4014.9211 272868.8 5109.07207 Oct 2 -2240.2234 269003.6 6282.59277 Nov 2 2083.6765 265138.4 1124.91131 Dec 2 3292.1997 261117.3 -90.52651 Jan 3 492.7436 257096.2 -1823.98503 Feb 3 -4272.5698 253473.1 -2937.57295 Mar 3 551.9182 249850.0 -5303.96217 Apr 3 7452.7139 247188.0 -7671.73862 May 3 10240.1149 244526.0 -6433.12025 Jun 3 9362.9436 243205.6 -4634.55203 Jul 3 -12191.0265 241885.2 -2855.18499 Aug 3 -10757.5752 241815.2 -5503.61156 Sep 3 -4014.9211 241745.2 -645.24091 Oct 3 -2240.2234 242478.5 -3158.26506 Nov 3 2083.6765 243211.8 -256.49135 Dec 3 3292.1997 244249.9 998.93624 Jan 4 492.7436 245287.9 1324.34314 Feb 4 -4272.5698 246524.2 1170.32161 Mar 4 551.9182 247760.6 2330.49876 Apr 4 7452.7139 249176.0 -1965.66513 May 4 10240.1149 250591.3 161.56580 Jun 4 9362.9436 252218.0 -3024.95342 Jul 4 -12191.0265 253844.7 -6281.67383 Aug 4 -10757.5752 255951.0 863.61668 Sep 4 -4014.9211 258057.2 -689.29560 Oct 4 -2240.2234 260720.2 -3281.97491 Nov 4 2083.6765 263383.2 -1290.85637 Dec 4 3292.1997 266205.8 -463.96012 Jan 5 492.7436 269028.3 -3660.08457 Feb 5 -4272.5698 271508.1 2590.46424 Mar 5 551.9182 273987.9 3966.21175 Apr 5 7452.7139 275231.1 9616.16378 May 5 10240.1149 276474.4 4011.51064 Jun 5 9362.9436 277570.1 2868.92497 Jul 5 -12191.0265 278665.9 4836.13811 Aug 5 -10757.5752 279659.8 5449.77811 Sep 5 -4014.9211 280653.7 -1422.78468 Oct 5 -2240.2234 281491.5 -2415.27552 Nov 5 2083.6765 282329.3 -4004.96851 Dec 5 3292.1997 283034.7 -6136.93471 > m$win s t l 601 19 13 > m$deg s t l 0 1 1 > m$jump s t l 61 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/16atc1324325877.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/wessaorg/rcomp/tmp/2n1h51324325877.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/wessaorg/rcomp/tmp/37hqf1324325877.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/wessaorg/rcomp/tmp/4afat1324325877.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/5tlzh1324325877.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/wessaorg/rcomp/tmp/6uwx11324325877.tab") > > try(system("convert tmp/16atc1324325877.ps tmp/16atc1324325877.png",intern=TRUE)) character(0) > try(system("convert tmp/2n1h51324325877.ps tmp/2n1h51324325877.png",intern=TRUE)) character(0) > try(system("convert tmp/37hqf1324325877.ps tmp/37hqf1324325877.png",intern=TRUE)) character(0) > try(system("convert tmp/4afat1324325877.ps tmp/4afat1324325877.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.344 0.260 1.670