R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(548604,563668,586111,604378,600991,544686,537034,551531,563250,574761,580112,575093,557560,564478,580523,596594,586570,536214,523597,536535,536322,532638,528222,516141,501866,506174,517945,533590,528379,477580,469357,490243,492622,507561,516922,514258,509846,527070,541657,564591,555362,498662,511038,525919,531673,548854,560576,557274,565742) > 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 -8479.3562 565282.2 -8198.82483 Feb 1 -350.5968 565906.0 -1887.40702 Mar 1 16300.5924 566529.8 3280.58110 Apr 1 34774.4978 567076.8 2526.66415 May 1 28056.4047 567623.8 5310.74565 Jun 1 -25471.2896 568106.8 2050.51118 Jul 1 -29487.9924 568589.7 -2067.71480 Aug 1 -13825.0195 568946.0 -3589.97293 Sep 1 -9052.8010 569302.3 3000.52341 Oct 1 861.3857 568965.3 4934.36410 Nov 1 6293.3235 568628.2 5190.45358 Dec 1 380.8493 567631.5 7080.63487 Jan 2 -8479.3562 566634.8 -595.45256 Feb 2 -350.5968 564878.5 -49.90264 Mar 2 16300.5924 563122.2 1100.21759 Apr 2 34774.4978 559974.9 1844.59596 May 2 28056.4047 556827.6 1685.97277 Jun 2 -25471.2896 552449.3 9235.98301 Jul 2 -29487.9924 548071.0 5014.00174 Aug 2 -13825.0195 542960.0 7399.98389 Sep 2 -9052.8010 537849.1 7525.72052 Oct 2 861.3857 532449.6 -672.94909 Nov 2 6293.3235 527050.0 -5121.36990 Dec 2 380.8493 522030.8 -6270.62840 Jan 3 -8479.3562 517011.5 -6666.15561 Feb 3 -350.5968 513152.2 -6627.56722 Mar 3 16300.5924 509292.8 -7648.40852 Apr 3 34774.4978 507230.0 -8414.48401 May 3 28056.4047 505167.2 -4844.56105 Jun 3 -25471.2896 505049.3 -1998.01839 Jul 3 -29487.9924 504931.5 -6086.46724 Aug 3 -13825.0195 506381.0 -2312.98446 Sep 3 -9052.8010 507830.5 -6155.74720 Oct 3 861.3857 510146.7 -3447.10511 Nov 3 6293.3235 512462.9 -1834.21421 Dec 3 380.8493 515164.3 -1287.10309 Jan 4 -8479.3562 517865.6 459.73933 Feb 4 -350.5968 520915.5 6505.08826 Mar 4 16300.5924 523965.4 1391.00750 Apr 4 34774.4978 527389.4 2427.06786 May 4 28056.4047 530813.5 -3507.87334 Jun 4 -25471.2896 534692.4 -10559.10279 Jul 4 -29487.9924 538571.3 1954.67625 Aug 4 -13825.0195 542496.3 -2752.23878 Sep 4 -9052.8010 546421.2 -5695.39933 Oct 4 861.3857 550391.8 -2399.17456 Nov 4 6293.3235 554362.4 -79.70100 Dec 4 380.8493 558428.7 -1535.58452 Jan 5 -8479.3562 562495.1 11726.26326 > m$win s t l 491 19 13 > m$deg s t l 0 1 1 > m$jump s t l 50 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/1qmcz1293566062.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/rcomp/tmp/2jvbk1293566062.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/rcomp/tmp/3jvbk1293566062.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/rcomp/tmp/4untn1293566062.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/58frw1293566062.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/rcomp/tmp/6tf721293566062.tab") > > try(system("convert tmp/1qmcz1293566062.ps tmp/1qmcz1293566062.png",intern=TRUE)) character(0) > try(system("convert tmp/2jvbk1293566062.ps tmp/2jvbk1293566062.png",intern=TRUE)) character(0) > try(system("convert tmp/3jvbk1293566062.ps tmp/3jvbk1293566062.png",intern=TRUE)) character(0) > try(system("convert tmp/4untn1293566062.ps tmp/4untn1293566062.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.080 0.730 1.799