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(104.31,103.88,103.88,103.86,103.89,103.98,103.98,104.29,104.29,104.24,103.98,103.54,103.44,103.32,103.30,103.26,103.14,103.11,102.91,103.23,103.23,103.14,102.91,102.42,102.10,102.07,102.06,101.98,101.83,101.75,101.56,101.66,101.65,101.61,101.52,101.31,101.19,101.11,101.10,101.07,100.98,100.93,100.92,101.02,101.01,100.97,100.89,100.62,100.53,100.48,100.48,100.47,100.52,100.49,100.47,100.44) > 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.10860145 104.2376 0.1809889673 Feb 1 -0.18662904 104.1955 -0.1288814501 Mar 1 -0.13065676 104.1534 -0.1427517472 Apr 1 -0.10439046 104.1082 -0.1438225453 May 1 -0.09812423 104.0630 -0.0748932632 Jun 1 -0.05722130 104.0145 0.0227462898 Jul 1 -0.08031840 103.9659 0.0943858732 Aug 1 0.13999342 103.9176 0.2324268453 Sep 1 0.25590261 103.8692 0.1648704542 Oct 1 0.27611113 103.8160 0.1478720674 Nov 1 0.18631966 103.7628 0.0308736714 Dec 1 -0.09238521 103.6852 -0.0527786576 Jan 2 -0.10860145 103.6075 -0.0589196154 Feb 2 -0.18662904 103.5193 -0.0127021478 Mar 2 -0.13065676 103.4311 -0.0004845599 Apr 2 -0.10439046 103.3425 0.0218851621 May 2 -0.09812423 103.2539 -0.0157450358 Jun 2 -0.05722130 103.1597 0.0075394169 Jul 2 -0.08031840 103.0655 -0.0751760999 Aug 2 0.13999342 102.9619 0.1281488087 Sep 2 0.25590261 102.8582 0.1158763542 Oct 2 0.27611113 102.7487 0.1151445258 Nov 2 0.18631966 102.6393 0.0844126882 Dec 2 -0.09238521 102.5232 -0.0107758725 Jan 3 -0.10860145 102.4071 -0.1984530619 Feb 3 -0.18662904 102.2824 -0.0257457439 Mar 3 -0.13065676 102.1577 0.0329616945 Apr 3 -0.10439046 102.0373 0.0470749354 May 3 -0.09812423 101.9169 0.0111882566 Jun 3 -0.05722130 101.8163 -0.0090872338 Jul 3 -0.08031840 101.7157 -0.0753626937 Aug 3 0.13999342 101.6327 -0.1126918298 Sep 3 0.25590261 101.5497 -0.1556183290 Oct 3 0.27611113 101.4778 -0.1438944936 Nov 3 0.18631966 101.4059 -0.0721706674 Dec 3 -0.09238521 101.3462 0.0561652794 Jan 4 -0.10860145 101.2866 0.0120125975 Feb 4 -0.18662904 101.2335 0.0630905681 Mar 4 -0.13065676 101.1805 0.0501686591 Apr 4 -0.10439046 101.1256 0.0488235061 May 4 -0.09812423 101.0706 0.0074784334 Jun 4 -0.05722130 101.0128 -0.0255536550 Jul 4 -0.08031840 100.9549 0.0454142871 Aug 4 0.13999342 100.9003 -0.0202984581 Sep 4 0.25590261 100.8457 -0.0916085664 Oct 4 0.27611113 100.7991 -0.1052196437 Nov 4 0.18631966 100.7525 -0.0488307302 Dec 4 -0.09238521 100.7177 -0.0052695204 Jan 5 -0.10860145 100.6828 -0.0441969393 Feb 5 -0.18662904 100.6463 0.0203267206 Mar 5 -0.13065676 100.6098 0.0008505010 Apr 5 -0.10439046 100.5743 0.0001107979 May 5 -0.09812423 100.5388 0.0793711750 Jun 5 -0.05722130 100.5042 0.0429721514 Jul 5 -0.08031840 100.4697 0.0805731583 Aug 5 0.13999342 100.4356 -0.1355686561 > m$win s t l 561 19 13 > m$deg s t l 0 1 1 > m$jump s t l 57 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1bhz61292778955.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/2bhz61292778955.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/33qyr1292778955.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/43qyr1292778955.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/5z0eh1292778955.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/6eaur1292778955.tab") > > try(system("convert tmp/1bhz61292778955.ps tmp/1bhz61292778955.png",intern=TRUE)) character(0) > try(system("convert tmp/2bhz61292778955.ps tmp/2bhz61292778955.png",intern=TRUE)) character(0) > try(system("convert tmp/33qyr1292778955.ps tmp/33qyr1292778955.png",intern=TRUE)) character(0) > try(system("convert tmp/43qyr1292778955.ps tmp/43qyr1292778955.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.962 0.610 2.127