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(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,294563) > 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 8072.74998 276969.7 1559.5179 Feb 1 3522.40906 277136.6 2383.0071 Mar 1 -2114.65148 277303.4 1498.2159 Apr 1 55.40003 277535.5 324.1288 May 1 1882.05333 277767.5 -2521.5601 Jun 1 964.91452 278042.5 -1904.3702 Jul 1 -2699.62600 278317.4 -580.7787 Aug 1 -4329.99328 278600.2 -4120.1683 Sep 1 -10321.16186 278882.9 -1421.7565 Oct 1 -12704.84603 279294.7 -1596.8062 Nov 1 8067.07327 279706.4 -514.4594 Dec 1 9605.68017 280100.1 1480.1850 Jan 2 8072.74998 280493.9 3733.3665 Feb 2 3522.40906 280831.0 3832.5997 Mar 2 -2114.65148 281168.1 2423.5526 Apr 2 55.40003 281412.6 1187.9895 May 2 1882.05333 281657.1 -3349.1754 Jun 2 964.91452 281637.8 -2194.7157 Jul 2 -2699.62600 281618.5 -2082.8543 Aug 2 -4329.99328 281159.9 -1613.8978 Sep 2 -10321.16186 280701.3 3971.8600 Oct 2 -12704.84603 279777.2 4238.6858 Nov 2 8067.07327 278853.0 2881.9081 Dec 2 9605.68017 277371.8 3748.5686 Jan 3 8072.74998 275890.5 8336.7663 Feb 3 3522.40906 273740.1 1243.5112 Mar 3 -2114.65148 271589.7 350.9757 Apr 3 55.40003 268899.8 -3094.2107 May 3 1882.05333 266209.9 942.0012 Jun 3 964.91452 263459.9 -248.8141 Jul 3 -2699.62600 260709.9 -2812.2276 Aug 3 -4329.99328 258294.1 -611.1353 Sep 3 -10321.16186 255878.4 499.7583 Oct 3 -12704.84603 254002.5 -5925.6309 Nov 3 8067.07327 252126.6 -1637.6235 Dec 3 9605.68017 250591.3 796.0004 Jan 4 8072.74998 249056.1 -2465.8386 Feb 4 3522.40906 247733.2 -612.5807 Mar 4 -2114.65148 246410.3 -873.6031 Apr 4 55.40003 245298.9 1750.7128 May 4 1882.05333 244187.5 2471.4269 Jun 4 964.91452 243310.6 763.4550 Jul 4 -2699.62600 242433.7 -2654.1153 Aug 4 -4329.99328 242038.6 -623.5713 Sep 4 -10321.16186 241643.4 -5768.2261 Oct 4 -12704.84603 242239.9 -2696.0562 Nov 4 8067.07327 242836.4 -2969.4898 Dec 4 9605.68017 244822.7 -6095.3521 Jan 5 8072.74998 246808.9 -7912.6773 Feb 5 3522.40906 250021.6 -8445.9962 Mar 5 -2114.65148 253234.2 -4856.5955 Apr 5 55.40003 257200.5 -1490.9491 May 5 1882.05333 261166.9 1270.0955 Jun 5 964.91452 265120.2 2261.9348 Jul 5 -2699.62600 269073.5 6672.1758 Aug 5 -4329.99328 273066.3 5226.6553 Sep 5 -10321.16186 277059.2 691.9362 Oct 5 -12704.84603 281048.6 3649.2568 Nov 5 8067.07327 285038.0 -395.0260 Dec 5 9605.68017 288959.0 -2683.6345 Jan 6 8072.74998 292880.0 -6389.7058 > m$win s t l 611 19 13 > m$deg s t l 0 1 1 > m$jump s t l 62 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1xttw1291924025.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/28ksz1291924025.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/38ksz1291924025.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/4jt9k1291924025.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/5flpb1291924025.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/60l5z1291924025.tab") > > try(system("convert tmp/1xttw1291924025.ps tmp/1xttw1291924025.png",intern=TRUE)) character(0) > try(system("convert tmp/28ksz1291924025.ps tmp/28ksz1291924025.png",intern=TRUE)) character(0) > try(system("convert tmp/38ksz1291924025.ps tmp/38ksz1291924025.png",intern=TRUE)) character(0) > try(system("convert tmp/4jt9k1291924025.ps tmp/4jt9k1291924025.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.956 0.619 2.229