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(2849.27,2921.44,2981.85,3080.58,3106.22,3119.31,3061.26,3097.31,3161.69,3257.16,3277.01,3295.32,3363.99,3494.17,3667.03,3813.06,3917.96,3895.51,3801.06,3570.12,3701.61,3862.27,3970.1,4138.52,4199.75,4290.89,4443.91,4502.64,4356.98,4591.27,4696.96,4621.4,4562.84,4202.52,4296.49,4435.23,4105.18,4116.68,3844.49,3720.98,3674.4,3857.62,3801.06,3504.37,3032.6,3047.03,2962.34,2197.82,2014.45,1862.83,1905.41,1810.99,1670.07,1864.44,2052.02,2029.6,2070.83,2293.41,2443.27,2513.17) > 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 -101.686920 2914.513 36.444325 Feb 1 -60.985438 2949.887 32.537971 Mar 1 -19.622019 2985.262 16.209680 Apr 1 -5.331179 3023.161 62.750655 May 1 -48.676356 3061.059 93.837648 Jun 1 78.397546 3101.640 -60.727356 Jul 1 101.809395 3142.221 -182.770306 Aug 1 -0.478600 3184.238 -86.448960 Sep 1 -43.500590 3226.254 -21.063618 Oct 1 1.966440 3280.285 -25.091526 Nov 1 78.233607 3334.316 -135.539572 Dec 1 19.874489 3400.577 -125.131651 Jan 2 -101.686920 3466.838 -1.161439 Feb 2 -60.985438 3524.495 30.660101 Mar 2 -19.622019 3582.152 104.499704 Apr 2 -5.331179 3633.388 185.003570 May 2 -48.676356 3684.623 282.013454 Jun 2 78.397546 3740.190 76.922212 Jul 2 101.809395 3795.758 -96.506975 Aug 2 -0.478600 3853.906 -283.307160 Sep 2 -43.500590 3912.054 -166.943350 Oct 2 1.966440 3972.422 -112.118687 Nov 2 78.233607 4032.791 -140.924162 Dec 2 19.874489 4102.210 16.435401 Jan 3 -101.686920 4171.630 129.807254 Feb 3 -60.985438 4244.151 107.724719 Mar 3 -19.622019 4316.672 146.860246 Apr 3 -5.331179 4363.077 144.894530 May 3 -48.676356 4409.482 -3.825169 Jun 3 78.397546 4421.045 91.827470 Jul 3 101.809395 4432.608 162.542164 Aug 3 -0.478600 4409.419 212.459309 Sep 3 -43.500590 4386.230 220.110449 Oct 3 1.966440 4332.760 -132.206559 Nov 3 78.233607 4279.290 -61.033706 Dec 3 19.874489 4205.972 209.383592 Jan 4 -101.686920 4132.654 74.213181 Feb 4 -60.985438 4040.904 136.761657 Mar 4 -19.622019 3949.154 -85.041804 Apr 4 -5.331179 3834.697 -108.385430 May 4 -48.676356 3720.239 2.836962 Jun 4 78.397546 3570.248 208.974511 Jul 4 101.809395 3420.256 278.994114 Aug 4 -0.478600 3246.254 258.594274 Sep 4 -43.500590 3072.252 3.848429 Oct 4 1.966440 2893.620 151.444031 Nov 4 78.233607 2714.987 169.119496 Dec 4 19.874489 2549.472 -371.526504 Jan 5 -101.686920 2383.957 -267.820214 Feb 5 -60.985438 2261.835 -338.019400 Mar 5 -19.622019 2139.713 -214.680523 Apr 5 -5.331179 2126.328 -310.006816 May 5 -48.676356 2112.943 -394.197091 Jun 5 78.397546 2109.905 -323.862290 Jul 5 101.809395 2106.866 -156.655435 Aug 5 -0.478600 2112.448 -82.369517 Sep 5 -43.500590 2118.030 -3.699603 Oct 5 1.966440 2134.150 157.293125 Nov 5 78.233607 2150.271 214.765716 Dec 5 19.874489 2174.380 318.915499 > 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/1lw721259949016.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/2qzgl1259949016.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/3fpw11259949016.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/4dzb81259949016.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/5tacr1259949016.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/6l5991259949016.tab") > system("convert tmp/1lw721259949016.ps tmp/1lw721259949016.png") > system("convert tmp/2qzgl1259949016.ps tmp/2qzgl1259949016.png") > system("convert tmp/3fpw11259949016.ps tmp/3fpw11259949016.png") > system("convert tmp/4dzb81259949016.ps tmp/4dzb81259949016.png") > > > proc.time() user system elapsed 0.965 0.631 1.217