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(105.7,105.7,111.1,82.4,60,107.3,99.3,113.5,108.9,100.2,103.9,138.7,120.2,100.2,143.2,70.9,85.2,133,136.6,117.9,106.3,122.3,125.5,148.4,126.3,99.6,140.4,80.3,92.6,138.5,110.9,119.6,105,109,129.4,148.6,101.4,134.8,143.7,81.6,90.3,141.5,140.7,140.2,100.2,125.7,119.6,134.7,109,116.3,146.9,97.4,89.4,132.1,139.8,129,112.5,121.9,121.7,123.1) > 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 -1.6547509 99.61625 7.73850266 Feb 1 -3.3354675 100.19607 8.83939638 Mar 1 21.9238311 100.77589 -11.59972507 Apr 1 -32.8580649 101.47495 13.78311243 May 1 -32.1199340 102.17401 -10.05407707 Jun 1 14.7768551 102.91158 -10.38843451 Jul 1 9.6736359 103.64915 -14.02278377 Aug 1 8.1417591 104.37500 0.98324272 Sep 1 -9.4301217 105.10085 13.22927312 Oct 1 -0.4502835 106.36754 -5.71725265 Nov 1 3.4895525 107.63422 -7.22377617 Dec 1 21.8429880 109.28371 7.57330189 Jan 2 -1.6547509 110.93320 10.92155438 Feb 2 -3.3354675 112.22538 -8.68991193 Mar 2 21.9238311 113.51756 7.75860659 Apr 2 -32.8580649 114.52866 -10.77059609 May 2 -32.1199340 115.53976 1.78017423 Jun 2 14.7768551 116.46921 1.75393306 Jul 2 9.6736359 117.39866 9.52770007 Aug 2 8.1417591 117.87702 -8.11877657 Sep 2 -9.4301217 118.35537 -2.62524930 Oct 2 -0.4502835 118.60403 4.14625369 Nov 2 3.4895525 118.85269 3.15775892 Dec 2 21.8429880 118.70928 7.84773332 Jan 3 -1.6547509 118.56587 9.38888214 Feb 3 -3.3354675 118.03060 -15.09513629 Mar 3 21.9238311 117.49534 0.98083010 Apr 3 -32.8580649 116.93600 -3.77793663 May 3 -32.1199340 116.37666 8.34326963 Jun 3 14.7768551 116.18038 7.54276265 Jul 3 9.6736359 115.98410 -14.75773615 Aug 3 8.1417591 116.38281 -4.92456977 Sep 3 -9.4301217 116.78152 -2.35139946 Oct 3 -0.4502835 117.32029 -7.87000202 Nov 3 3.4895525 117.85905 8.05139766 Dec 3 21.8429880 118.78458 7.97243503 Jan 4 -1.6547509 119.71010 -16.65535318 Feb 4 -3.3354675 120.79168 17.34378692 Mar 4 21.9238311 121.87326 -0.09708815 Apr 4 -32.8580649 122.24414 -7.78607026 May 4 -32.1199340 122.61501 -0.19507937 Jun 4 14.7768551 122.23432 4.48882743 Jul 4 9.6736359 121.85362 9.17274242 Aug 4 8.1417591 121.49515 10.56308818 Sep 4 -9.4301217 121.13668 -11.50656215 Oct 4 -0.4502835 120.98902 5.16125898 Nov 4 3.4895525 120.84137 -4.73091765 Dec 4 21.8429880 120.71404 -7.85702997 Jan 5 -1.6547509 120.58672 -9.93196786 Feb 5 -3.3354675 120.61270 -0.97723228 Mar 5 21.9238311 120.63868 4.33748812 Apr 5 -32.8580649 120.52452 9.73354144 May 5 -32.1199340 120.41037 1.10956776 Jun 5 14.7768551 120.01122 -2.68807815 Jul 5 9.6736359 119.61208 10.51428412 Aug 5 8.1417591 119.15852 1.69972016 Sep 5 -9.4301217 118.70496 3.22516012 Oct 5 -0.4502835 118.16084 4.18944553 Nov 5 3.4895525 117.61671 0.59373318 Dec 5 21.8429880 116.96483 -15.70781958 > 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/13dld1259698441.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/2p1l91259698441.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/3njpe1259698441.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/4640e1259698441.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/580fc1259698441.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/6h8j71259698441.tab") > system("convert tmp/13dld1259698441.ps tmp/13dld1259698441.png") > system("convert tmp/2p1l91259698441.ps tmp/2p1l91259698441.png") > system("convert tmp/3njpe1259698441.ps tmp/3njpe1259698441.png") > system("convert tmp/4640e1259698441.ps tmp/4640e1259698441.png") > > > proc.time() user system elapsed 0.936 0.598 1.144