R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(2,1,-8,-1,1,-1,2,2,1,-1,-2,-2,-1,-8,-4,-6,-3,-3,-7,-9,-11,-13,-11,-9,-17,-22,-25,-20,-24,-24,-22,-19,-18,-17,-11,-11,-12,-10,-15,-15,-15,-13,-8,-13,-9,-7,-4,-4,-2,0) > 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 1.64124136 0.99201115 -0.63325252 Feb 1 -0.12056118 0.75709707 0.36346411 Mar 1 -4.08576680 0.52218298 -4.43641618 Apr 1 -1.40684261 0.24340308 0.16343954 May 1 -0.97791821 -0.03537683 2.01329504 Jun 1 -0.93363778 -0.33878314 0.27242092 Jul 1 0.61064052 -0.64218944 2.03154893 Aug 1 -0.37958441 -0.92744501 3.30702943 Sep 1 0.13018852 -1.21270058 2.08251206 Oct 1 -0.05655537 -1.52900267 0.58555804 Nov 1 2.50670223 -1.84530476 -2.66139747 Dec 1 3.07209462 -2.32238159 -2.74971303 Jan 2 1.64124136 -2.79945841 0.15821704 Feb 2 -0.12056118 -3.47955749 -4.39988133 Mar 2 -4.08576680 -4.15965657 4.24542337 Apr 2 -1.40684261 -4.96253489 0.36937750 May 2 -0.97791821 -5.76541321 3.74333142 Jun 2 -0.93363778 -6.73585710 4.66949488 Jul 2 0.61064052 -7.70630099 0.09566048 Aug 2 -0.37958441 -9.05086303 0.43044745 Sep 2 0.13018852 -10.39542507 -0.73476345 Oct 2 -0.05655537 -11.98066512 -0.96277951 Nov 2 2.50670223 -13.56590517 0.05920294 Dec 2 3.07209462 -15.04012827 2.96803366 Jan 3 1.64124136 -16.51435138 -2.12688999 Feb 3 -0.12056118 -17.51419722 -4.36524160 Mar 3 -4.08576680 -18.51404306 -2.40019014 Apr 3 -1.40684261 -18.91992111 0.32676372 May 3 -0.97791821 -19.32579916 -3.69628263 Jun 3 -0.93363778 -19.13973074 -3.92663148 Jul 3 0.61064052 -18.95366232 -3.65697820 Aug 3 -0.37958441 -18.25734668 -0.36306891 Sep 3 0.13018852 -17.56103103 -0.56915749 Oct 3 -0.05655537 -16.70758131 -0.23586332 Nov 3 2.50670223 -15.85413159 2.34742936 Dec 3 3.07209462 -14.99740312 0.92530850 Jan 4 1.64124136 -14.14067465 0.49943329 Feb 4 -0.12056118 -13.41029907 3.53086025 Mar 4 -4.08576680 -12.67992349 1.76569029 Apr 4 -1.40684261 -12.04855512 -1.54460227 May 4 -0.97791821 -11.41718675 -2.60489504 Jun 4 -0.93363778 -10.62150363 -1.44485860 Jul 4 0.61064052 -9.82582050 1.21517999 Aug 4 -0.37958441 -8.95678499 -3.66363060 Sep 4 0.13018852 -8.08774948 -1.04243904 Oct 4 -0.05655537 -7.19091773 0.24747310 Nov 4 2.50670223 -6.29408599 -0.21261625 Dec 4 3.07209462 -5.35892673 -1.71316789 Jan 5 1.64124136 -4.42376748 0.78252611 Feb 5 -0.12056118 -3.45295409 3.57351527 > m$win s t l 501 19 13 > m$deg s t l 0 1 1 > m$jump s t l 51 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/18yuo1292250196.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/freestat/rcomp/tmp/2j7tr1292250196.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/freestat/rcomp/tmp/3j7tr1292250196.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/freestat/rcomp/tmp/4bybu1292250196.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/5q8821292250196.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/freestat/rcomp/tmp/6trpq1292250196.tab") > > try(system("convert tmp/18yuo1292250196.ps tmp/18yuo1292250196.png",intern=TRUE)) character(0) > try(system("convert tmp/2j7tr1292250196.ps tmp/2j7tr1292250196.png",intern=TRUE)) character(0) > try(system("convert tmp/3j7tr1292250196.ps tmp/3j7tr1292250196.png",intern=TRUE)) character(0) > try(system("convert tmp/4bybu1292250196.ps tmp/4bybu1292250196.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.358 0.855 1.525