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(1.4816,1.4562,1.4268,1.4088,1.4016,1.3650,1.3190,1.3050,1.2785,1.3239,1.3449,1.2732,1.3322,1.4369,1.4975,1.5770,1.5553,1.5557,1.5750,1.5527,1.4748,1.4718,1.4570,1.4684,1.4227,1.3896,1.3622,1.3716,1.3419,1.3511,1.3516,1.3242,1.3074,1.2999,1.3213,1.2881,1.2611,1.2727,1.2811,1.2684,1.2650,1.2770,1.2271,1.2020,1.1938,1.2103,1.1856,1.1786,1.2015,1.2256,1.2292,1.2037,1.2165,1.2694,1.2938,1.3201,1.3014,1.3119,1.3408,1.2991) > 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.0087760371 1.422163 0.068212633 Feb 1 0.0097111729 1.412139 0.034349996 Mar 1 0.0149783845 1.402114 0.009707357 Apr 1 0.0219420616 1.393882 -0.007023768 May 1 0.0125257037 1.385649 0.003425141 Jun 1 0.0207472857 1.379068 -0.034815227 Jul 1 0.0110488697 1.372487 -0.064535598 Aug 1 0.0003260343 1.367166 -0.062491553 Sep 1 -0.0275167883 1.361844 -0.055827520 Oct 1 -0.0136787624 1.366840 -0.029260903 Nov 1 -0.0058607343 1.371835 -0.021074289 Dec 1 -0.0354471333 1.390401 -0.081753376 Jan 2 -0.0087760371 1.408966 -0.067989958 Feb 2 0.0097111729 1.429586 -0.002397032 Mar 2 0.0149783845 1.450206 0.032315893 Apr 2 0.0219420616 1.466829 0.088228452 May 2 0.0125257037 1.483453 0.059321046 Jun 2 0.0207472857 1.492522 0.042431084 Jul 2 0.0110488697 1.501590 0.062361119 Aug 2 0.0003260343 1.498054 0.054320136 Sep 2 -0.0275167883 1.494518 0.007799140 Oct 2 -0.0136787624 1.479419 0.006059512 Nov 2 -0.0058607343 1.464321 -0.001460119 Dec 2 -0.0354471333 1.445329 0.058517831 Jan 3 -0.0087760371 1.426338 0.005138286 Feb 3 0.0097111729 1.408502 -0.028613617 Mar 3 0.0149783845 1.390667 -0.043445521 Apr 3 0.0219420616 1.375981 -0.026323396 May 3 0.0125257037 1.361296 -0.031921236 Jun 3 0.0207472857 1.349467 -0.019114332 Jul 3 0.0110488697 1.337639 0.002912569 Aug 3 0.0003260343 1.328577 -0.004703130 Sep 3 -0.0275167883 1.319516 0.015401158 Oct 3 -0.0136787624 1.311798 0.001780615 Nov 3 -0.0058607343 1.304081 0.023080070 Dec 3 -0.0354471333 1.295650 0.027896981 Jan 4 -0.0087760371 1.287220 -0.017343603 Feb 4 0.0097111729 1.277608 -0.014619212 Mar 4 0.0149783845 1.267996 -0.001874823 Apr 4 0.0219420616 1.258446 -0.011988194 May 4 0.0125257037 1.248896 0.003578471 Jun 4 0.0207472857 1.241150 0.015102265 Jul 4 0.0110488697 1.233405 -0.017353942 Aug 4 0.0003260343 1.228061 -0.026386713 Sep 4 -0.0275167883 1.222716 -0.001399497 Oct 4 -0.0136787624 1.218938 0.005040466 Nov 4 -0.0058607343 1.215160 -0.023699572 Dec 4 -0.0354471333 1.215448 -0.001400451 Jan 5 -0.0087760371 1.215735 -0.005458825 Feb 5 0.0097111729 1.222043 -0.006154547 Mar 5 0.0149783845 1.228352 -0.014130270 Apr 5 0.0219420616 1.241035 -0.059277469 May 5 0.0125257037 1.253719 -0.049744633 Jun 5 0.0207472857 1.266073 -0.017420187 Jul 5 0.0110488697 1.278427 0.004324258 Aug 5 0.0003260343 1.291457 0.028317210 Sep 5 -0.0275167883 1.304487 0.024430149 Oct 5 -0.0136787624 1.318299 0.007280035 Nov 5 -0.0058607343 1.332111 0.014549920 Dec 5 -0.0354471333 1.346357 -0.011809730 > 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/www/html/rcomp/tmp/13bgj1259929381.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/2h87u1259929381.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/3ov841259929381.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/49mfm1259929381.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/5tu471259929381.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/6ude91259929381.tab") > system("convert tmp/13bgj1259929381.ps tmp/13bgj1259929381.png") > system("convert tmp/2h87u1259929381.ps tmp/2h87u1259929381.png") > system("convert tmp/3ov841259929381.ps tmp/3ov841259929381.png") > system("convert tmp/49mfm1259929381.ps tmp/49mfm1259929381.png") > > > proc.time() user system elapsed 0.972 0.623 2.873