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(5560,3922,3759,4138,4634,3996,4308,4143,4429,5219,4929,5755,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5526,4247,3830,4394,4826,4409,4569,4106,4794,3914,3793,4405,4022,4100,4788,3163,3585,3903,4178,3863,4187) > 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 664.80467 4252.381 642.813969 Feb 1 -439.47715 4299.189 62.288608 Mar 1 -258.51957 4345.996 -328.476159 Apr 1 -102.97778 4396.638 -155.660323 May 1 235.96445 4447.280 -49.244930 Jun 1 -404.32484 4498.909 -98.584565 Jul 1 67.18617 4550.538 -309.724512 Aug 1 -142.94432 4603.241 -317.296887 Sep 1 -143.47570 4655.944 -83.468381 Oct 1 396.54333 4723.009 99.447921 Nov 1 13.76197 4790.073 125.164604 Dec 1 113.45844 4859.617 781.924483 Jan 2 664.80467 4929.161 -1.965392 Feb 2 -439.47715 5003.234 -400.756497 Mar 2 -258.51957 5077.307 143.212992 Apr 2 -102.97778 5124.433 186.544376 May 2 235.96445 5171.560 -652.524683 Jun 2 -404.32484 5186.591 -291.266129 Jul 2 67.18617 5201.622 463.192112 Aug 2 -142.94432 5208.258 665.686676 Sep 2 -143.47570 5214.894 -31.417880 Oct 2 396.54333 5208.424 497.032531 Nov 2 13.76197 5201.955 -311.716679 Dec 2 113.45844 5162.635 92.906455 Jan 3 664.80467 5123.316 -210.120165 Feb 3 -439.47715 5052.267 6.209720 Mar 3 -258.51957 4981.219 8.300199 Apr 3 -102.97778 4908.909 205.068556 May 3 235.96445 4836.599 226.436470 Jun 3 -404.32484 4769.371 -219.045964 Jul 3 67.18617 4702.143 -144.328709 Aug 3 -142.94432 4649.172 229.772458 Sep 3 -143.47570 4596.201 -233.725494 Oct 3 396.54333 4564.944 154.513074 Nov 3 13.76197 4533.686 -342.447979 Dec 3 113.45844 4516.091 -508.549514 Jan 4 664.80467 4498.496 -60.300802 Feb 4 -439.47715 4491.746 247.731552 Mar 4 -258.51957 4484.995 351.524501 Apr 4 -102.97778 4483.947 -571.969567 May 4 235.96445 4482.900 807.135922 Jun 4 -404.32484 4471.658 179.666458 Jul 4 67.18617 4460.417 -697.603317 Aug 4 -142.94432 4428.392 108.552286 Sep 4 -143.47570 4396.367 573.108770 Oct 4 396.54333 4362.109 -349.652020 Nov 4 13.76197 4327.850 227.387569 Dec 4 113.45844 4302.203 -309.661869 Jan 5 664.80467 4276.556 -147.361061 Feb 5 -439.47715 4239.086 114.391262 Mar 5 -258.51957 4201.615 -150.095821 Apr 5 -102.97778 4149.369 358.608676 May 5 235.96445 4097.123 -311.087270 Jun 5 -404.32484 4045.376 458.948667 Jul 5 67.18617 3993.630 727.184292 Aug 5 -142.94432 3940.420 -634.475465 Sep 5 -143.47570 3887.210 -158.734341 Oct 5 396.54333 3830.355 -323.898328 Nov 5 13.76197 3773.500 390.738066 Dec 5 113.45844 3714.461 35.080676 Jan 6 664.80467 3655.422 -133.226467 > m$win s t l 611 19 13 > m$deg s t l 0 1 1 > m$jump s t l 62 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/17azp1259936973.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/2ncrp1259936973.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/3hdmd1259936973.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/4lbev1259936973.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/5afej1259936973.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/66keh1259936973.tab") > system("convert tmp/17azp1259936973.ps tmp/17azp1259936973.png") > system("convert tmp/2ncrp1259936973.ps tmp/2ncrp1259936973.png") > system("convert tmp/3hdmd1259936973.ps tmp/3hdmd1259936973.png") > system("convert tmp/4lbev1259936973.ps tmp/4lbev1259936973.png") > > > proc.time() user system elapsed 1.002 0.622 1.168