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(101.76,102.37,102.38,102.86,102.87,102.92,102.95,103.02,104.08,104.16,104.24,104.33,104.73,104.86,105.03,105.62,105.63,105.63,105.94,106.61,107.69,107.78,107.93,108.48,108.14,108.48,108.48,108.89,108.93,109.21,109.47,109.80,111.73,111.85,112.12,112.15,112.17,112.67,112.80,113.44,113.53,114.53,114.51,115.05,116.67,117.07,116.92,117.00,117.02,117.35,117.36,117.82,117.88,118.24,118.50,118.80,119.76,120.09) > 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 -0.3147090 102.2621 -0.18737333 Feb 1 -0.2006323 102.4340 0.13661390 Mar 1 -0.4045555 102.6060 0.17860101 Apr 1 -0.1377992 102.7850 0.21280378 May 1 -0.3450429 102.9640 0.25100658 Jun 1 -0.2524099 103.1522 0.02017820 Jul 1 -0.3297770 103.3404 -0.06065010 Aug 1 -0.2132891 103.5332 -0.29988430 Sep 1 0.8511989 103.7259 -0.49711870 Oct 1 0.7572336 103.9377 -0.53491792 Nov 1 0.3813379 104.1494 -0.29078678 Dec 1 0.2084449 104.4083 -0.28674464 Jan 2 -0.3147090 104.6672 0.37755838 Feb 2 -0.2006323 104.9560 0.10467390 Mar 2 -0.4045555 105.2448 0.18978930 Apr 2 -0.1377992 105.5450 0.21277160 May 2 -0.3450429 105.8453 0.12975392 Jun 2 -0.2524099 106.1445 -0.26213704 Jul 2 -0.3297770 106.4438 -0.17402793 Aug 2 -0.2132891 106.7390 0.08431194 Sep 2 0.8511989 107.0341 -0.19534839 Oct 2 0.7572336 107.3279 -0.30517374 Nov 2 0.3813379 107.6217 -0.07306872 Dec 2 0.2084449 107.9140 0.35759472 Jan 3 -0.3147090 108.2062 0.24851902 Feb 3 -0.2006323 108.5043 0.17635322 Mar 3 -0.4045555 108.8024 0.08218730 Apr 3 -0.1377992 109.1153 -0.08749250 May 3 -0.3450429 109.4282 -0.15317229 Jun 3 -0.2524099 109.7563 -0.29384205 Jul 3 -0.3297770 110.0843 -0.28451174 Aug 3 -0.2132891 110.4388 -0.42552881 Sep 3 0.8511989 110.7933 0.08545392 Oct 3 0.7572336 111.1821 -0.08937118 Nov 3 0.3813379 111.5709 0.16773409 Dec 3 0.2084449 111.9866 -0.04502024 Jan 4 -0.3147090 112.4022 0.08248631 Feb 4 -0.2006323 112.8253 0.04529125 Mar 4 -0.4045555 113.2485 -0.04390393 Apr 4 -0.1377992 113.6653 -0.08754398 May 4 -0.3450429 114.0822 -0.20718401 Jun 4 -0.2524099 114.4908 0.29156537 Jul 4 -0.3297770 114.8995 -0.05968517 Aug 4 -0.2132891 115.2938 -0.03051480 Sep 4 0.8511989 115.6881 0.13065536 Oct 4 0.7572336 116.0557 0.25711397 Nov 4 0.3813379 116.4232 0.11550295 Dec 4 0.2084449 116.7561 0.03546142 Jan 5 -0.3147090 117.0890 0.24568076 Feb 5 -0.2006323 117.3630 0.18759879 Mar 5 -0.4045555 117.6370 0.12751669 Apr 5 -0.1377992 117.9039 0.05389633 May 5 -0.3450429 118.1708 0.05427598 Jun 5 -0.2524099 118.4335 0.05889371 Jul 5 -0.3297770 118.6963 0.13351151 Aug 5 -0.2132891 118.9544 0.05890995 Sep 5 0.8511989 119.2125 -0.30369181 Oct 5 0.7572336 119.4667 -0.13394877 > m$win s t l 581 19 13 > m$deg s t l 0 1 1 > m$jump s t l 59 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/148ue1324648940.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/2v9rv1324648940.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/3a9a61324648940.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/4v4hi1324648940.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/5o1kf1324648940.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/6nmgc1324648941.tab") > > try(system("convert tmp/148ue1324648940.ps tmp/148ue1324648940.png",intern=TRUE)) character(0) > try(system("convert tmp/2v9rv1324648940.ps tmp/2v9rv1324648940.png",intern=TRUE)) character(0) > try(system("convert tmp/3a9a61324648940.ps tmp/3a9a61324648940.png",intern=TRUE)) character(0) > try(system("convert tmp/4v4hi1324648940.ps tmp/4v4hi1324648940.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.227 0.225 1.455