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(114,116,153,162,161,149,139,135,130,127,122,117,112,113,149,157,157,147,137,132,125,123,117,114,111,112,144,150,149,134,123,116,117,111,105,102,95,93,124,130,124,115,106,105,105,101,95,93,84,87,116,120,117,109,105,107,109,109,108,107) > 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 -19.397013 137.6767 -4.27969030 Feb 1 -17.863849 137.3303 -3.46644862 Mar 1 15.669317 136.9839 0.34679201 Apr 1 22.492399 136.5999 2.90774175 May 1 20.515482 136.2158 4.26869148 Jun 1 9.921508 135.8448 3.23365911 Jul 1 1.327533 135.4738 2.19862727 Aug 1 -1.426105 135.1211 1.30499934 Sep 1 -2.979741 134.7684 -1.78863082 Oct 1 -5.624465 134.2945 -1.67008309 Nov 1 -10.069190 133.8207 -1.75153536 Dec 1 -12.565871 133.5913 -4.02538616 Jan 2 -19.397013 133.3618 -1.96477673 Feb 2 -17.863849 133.2539 -2.39004592 Mar 2 15.669317 133.1460 0.18468384 Apr 2 22.492399 132.9523 1.55531733 May 2 20.515482 132.7586 3.72595082 Jun 2 9.921508 132.4663 4.61218561 Jul 2 1.327533 132.1740 3.49842092 Aug 2 -1.426105 131.7578 1.66828599 Sep 2 -2.979741 131.3416 -3.36185116 Oct 2 -5.624465 130.7036 -2.07915077 Nov 2 -10.069190 130.0656 -2.99645039 Dec 2 -12.565871 129.2167 -2.65079296 Jan 3 -19.397013 128.3677 2.02932468 Feb 3 -17.863849 127.4498 2.41407089 Mar 3 15.669317 126.5319 1.79881605 Apr 3 22.492399 125.5311 1.97649581 May 3 20.515482 124.5303 3.95417558 Jun 3 9.921508 123.2886 0.78991577 Jul 3 1.327533 122.0468 -0.37434351 Aug 3 -1.426105 120.5067 -3.08063331 Sep 3 -2.979741 118.9667 1.01307467 Oct 3 -5.624465 117.2721 -0.64767026 Nov 3 -10.069190 115.5776 -0.50841519 Dec 3 -12.565871 113.9910 0.57483191 Jan 4 -19.397013 112.4045 1.99253922 Feb 4 -17.863849 111.1750 -0.31119154 Mar 4 15.669317 109.9456 -1.61492335 Apr 4 22.492399 109.0057 -1.49810476 May 4 20.515482 108.0658 -4.58128618 Jun 4 9.921508 107.3382 -2.25966551 Jul 4 1.327533 106.6105 -1.93804432 Aug 4 -1.426105 106.0280 0.39809558 Sep 4 -2.979741 105.4455 2.53423326 Oct 4 -5.624465 104.8759 1.74856603 Nov 4 -10.069190 104.3063 0.76289879 Dec 4 -12.565871 103.8113 1.75461957 Jan 5 -19.397013 103.3162 0.08080057 Feb 5 -17.863849 103.2232 1.64062742 Mar 5 15.669317 103.1302 -2.79954678 Apr 5 22.492399 104.2660 -6.75843871 May 5 20.515482 105.4018 -8.91733063 Jun 5 9.921508 106.6184 -7.53990904 Jul 5 1.327533 107.8350 -4.16248693 Aug 5 -1.426105 109.1535 -0.72736954 Sep 5 -2.979741 110.4720 1.50774563 Oct 5 -5.624465 111.9596 2.66483816 Nov 5 -10.069190 113.4473 4.62193069 Dec 5 -12.565871 115.0710 4.49491533 > 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/1ssrw1259946764.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/2z1u11259946764.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/320xx1259946764.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/4uoko1259946764.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/5u8um1259946764.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/6gsup1259946764.tab") > system("convert tmp/1ssrw1259946764.ps tmp/1ssrw1259946764.png") > system("convert tmp/2z1u11259946764.ps tmp/2z1u11259946764.png") > system("convert tmp/320xx1259946764.ps tmp/320xx1259946764.png") > system("convert tmp/4uoko1259946764.ps tmp/4uoko1259946764.png") > > > proc.time() user system elapsed 0.946 0.618 1.132