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(0.7461,0.7775,0.7790,0.7744,0.7905,0.7719,0.7811,0.7557,0.7637,0.7595,0.7471,0.7615,0.7487,0.7389,0.7337,0.7510,0.7382,0.7159,0.7542,0.7636,0.7433,0.7658,0.7627,0.7480,0.7692,0.7850,0.7913,0.7720,0.7880,0.8070,0.8268,0.8244,0.8487,0.8572,0.8214,0.8827,0.9216,0.8865,0.8816,0.8884,0.9466,0.9180,0.9337,0.9559,0.9626,0.9434,0.8639,0.7996,0.6680,0.6572,0.6928,0.6438,0.6454,0.6873,0.7265,0.7912,0.8114,0.8281,0.8393) > 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.024035136 0.7986785 -0.0285433769 Feb 1 -0.025811504 0.7934204 0.0098910880 Mar 1 -0.019227873 0.7881623 0.0100655552 Apr 1 -0.029903531 0.7832831 0.0210204053 May 1 -0.014999195 0.7784039 0.0270952623 Jun 1 -0.015915828 0.7741226 0.0136932509 Jul 1 0.009327548 0.7698412 0.0019312318 Aug 1 0.024840839 0.7657580 -0.0348988300 Sep 1 0.034434135 0.7616748 -0.0324088959 Oct 1 0.040857961 0.7577417 -0.0390997079 Nov 1 0.018501766 0.7538087 -0.0252104997 Dec 1 0.001930903 0.7521071 0.0074619911 Jan 2 -0.024035136 0.7504055 0.0223296588 Feb 2 -0.025811504 0.7498997 0.0148118469 Mar 2 -0.019227873 0.7493938 0.0035340374 Apr 2 -0.029903531 0.7487337 0.0321698103 May 2 -0.014999195 0.7480736 0.0051255902 Jun 2 -0.015915828 0.7477169 -0.0159010959 Jul 2 0.009327548 0.7473602 -0.0024877898 Aug 2 0.024840839 0.7493429 -0.0105837168 Sep 2 0.034434135 0.7513255 -0.0424596481 Oct 2 0.040857961 0.7559297 -0.0309876777 Nov 2 0.018501766 0.7605339 -0.0163356871 Dec 2 0.001930903 0.7672233 -0.0211541553 Jan 3 -0.024035136 0.7739126 0.0193225533 Feb 3 -0.025811504 0.7814347 0.0293767634 Mar 3 -0.019227873 0.7889569 0.0215709758 Apr 3 -0.029903531 0.7960258 0.0058777531 May 3 -0.014999195 0.8030947 -0.0000954626 Jun 3 -0.015915828 0.8108310 0.0120848141 Jul 3 0.009327548 0.8185674 -0.0010949169 Aug 3 0.024840839 0.8276342 -0.0280750642 Sep 3 0.034434135 0.8367011 -0.0224352157 Oct 3 0.040857961 0.8474147 -0.0310726914 Nov 3 0.018501766 0.8581284 -0.0552301468 Dec 3 0.001930903 0.8695670 0.0112021155 Jan 4 -0.024035136 0.8810056 0.0646295546 Feb 4 -0.025811504 0.8916953 0.0206162229 Mar 4 -0.019227873 0.9023850 -0.0015571064 Apr 4 -0.029903531 0.9076746 0.0106289801 May 4 -0.014999195 0.9129641 0.0486350735 Jun 4 -0.015915828 0.9066437 0.0272721706 Jul 4 0.009327548 0.9003232 0.0240492601 Aug 4 0.024840839 0.8831229 0.0479362612 Sep 4 0.034434135 0.8659226 0.0622432581 Oct 4 0.040857961 0.8435522 0.0589898449 Nov 4 0.018501766 0.8211818 0.0242164520 Dec 4 0.001930903 0.7988115 -0.0011423812 Jan 5 -0.024035136 0.7764412 -0.0844060376 Feb 5 -0.025811504 0.7645655 -0.0815539971 Mar 5 -0.019227873 0.7526898 -0.0406619542 Apr 5 -0.029903531 0.7500050 -0.0763014528 May 5 -0.014999195 0.7473201 -0.0869209443 Jun 5 -0.015915828 0.7457599 -0.0425440974 Jul 5 0.009327548 0.7441997 -0.0270272582 Aug 5 0.024840839 0.7446094 0.0217497563 Sep 5 0.034434135 0.7450191 0.0319467666 Oct 5 0.040857961 0.7477004 0.0395416828 Nov 5 0.018501766 0.7503816 0.0704166192 > m$win s t l 591 19 13 > m$deg s t l 0 1 1 > m$jump s t l 60 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1asz31260373734.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/23qhl1260373734.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/3k6901260373734.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/4q9d41260373734.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/5rw8p1260373734.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/6s9mc1260373734.tab") > system("convert tmp/1asz31260373734.ps tmp/1asz31260373734.png") > system("convert tmp/23qhl1260373734.ps tmp/23qhl1260373734.png") > system("convert tmp/3k6901260373734.ps tmp/3k6901260373734.png") > system("convert tmp/4q9d41260373734.ps tmp/4q9d41260373734.png") > > > proc.time() user system elapsed 0.963 0.612 1.659