R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(89924,31795,27922,59954,52150,39964,34604,51106,52593,68794,47124,32315,42248,36088,52744,72586,92334,80761,71078,63713,57122,55243,62143,62708,62474,64250,71866,69886,58724,55298,52594,54854,54694,49298,44659,43657,47002,47042,48959,49750,54048,60067,68929,74617,75940,72762,75621,73008,74196,78878,83812,91624,89388,110410,113857,112060,117236,132810,137699,146409) > 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 1824.4253 54015.84 34083.73211 Feb 1 -10766.2838 53028.61 -10467.33111 Mar 1 -6348.8024 52041.39 -17770.58485 Apr 1 4222.7249 51188.87 4542.40182 May 1 3663.6632 50336.36 -1850.02261 Jun 1 2588.3712 49566.36 -12190.73482 Jul 1 454.2828 48796.37 -14646.65065 Aug 1 2386.5015 48250.86 468.63857 Sep 1 1508.1212 47705.35 3379.52679 Oct 1 4140.4970 48941.01 15712.48840 Nov 1 176.2876 50176.68 -3228.96482 Dec 1 -3849.7790 52771.52 -16606.74350 Jan 2 1824.4253 55366.37 -14942.79308 Feb 2 -10766.2838 57268.80 -10414.52092 Mar 2 -6348.8024 59171.24 -78.43926 Apr 2 4222.7249 60292.32 8070.95466 May 2 3663.6632 61413.40 27256.93750 Jun 2 2588.3712 62739.76 15432.86725 Jul 2 454.2828 64066.12 6557.59339 Aug 2 2386.5015 65017.49 -3690.99528 Sep 2 1508.1212 65968.86 -10354.98496 Oct 2 4140.4970 65589.37 -14486.86980 Nov 2 176.2876 65209.88 -3243.16946 Dec 2 -3849.7790 64113.34 2444.44046 Jan 3 1824.4253 63016.80 -2367.22053 Feb 3 -10766.2838 62187.62 12828.66303 Mar 3 -6348.8024 61358.45 16856.35609 Apr 3 4222.7249 60311.70 5351.57942 May 3 3663.6632 59264.95 -4204.60834 Jun 3 2588.3712 57564.75 -4855.12223 Jul 3 454.2828 55864.56 -3724.83973 Aug 3 2386.5015 54194.85 -1727.35526 Sep 3 1508.1212 52525.15 660.72820 Oct 3 4140.4970 51549.87 -6392.36887 Nov 3 176.2876 50574.59 -6091.88078 Dec 3 -3849.7790 50862.48 -3355.70169 Jan 4 1824.4253 51150.37 -5972.79350 Feb 4 -10766.2838 52591.31 5216.96947 Mar 4 -6348.8024 54032.26 1275.54194 Apr 4 4222.7249 56248.26 -10720.98467 May 4 3663.6632 58464.26 -8079.92237 Jun 4 2588.3712 60968.12 -3489.49287 Jul 4 454.2828 63471.98 5002.73302 Aug 4 2386.5015 66285.59 5944.91185 Sep 4 1508.1212 69099.19 5332.68967 Oct 4 4140.4970 72205.45 -3583.95109 Nov 4 176.2876 75311.72 132.99332 Dec 4 -3849.7790 78668.29 -1810.50758 Jan 5 1824.4253 82024.85 -9653.27939 Feb 5 -10766.2838 85689.86 3954.42878 Mar 5 -6348.8024 89354.86 805.94646 Apr 5 4222.7249 94608.57 -7207.29463 May 5 3663.6632 99862.28 -14137.94680 Jun 5 2588.3712 105399.30 2422.33092 Jul 5 454.2828 110936.31 2466.40502 Aug 5 2386.5015 116591.60 -6918.10413 Sep 5 1508.1212 122246.89 -6519.01429 Oct 5 4140.4970 128036.46 633.04270 Nov 5 176.2876 133826.03 3696.68487 Dec 5 -3849.7790 139742.81 10515.96775 > 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/wessaorg/rcomp/tmp/1dsqp1322218559.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/wessaorg/rcomp/tmp/24fq41322218559.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/wessaorg/rcomp/tmp/3icgo1322218559.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/wessaorg/rcomp/tmp/4hu3m1322218559.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/5antw1322218559.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/wessaorg/rcomp/tmp/6x2yx1322218559.tab") > > try(system("convert tmp/1dsqp1322218559.ps tmp/1dsqp1322218559.png",intern=TRUE)) character(0) > try(system("convert tmp/24fq41322218559.ps tmp/24fq41322218559.png",intern=TRUE)) character(0) > try(system("convert tmp/3icgo1322218559.ps tmp/3icgo1322218559.png",intern=TRUE)) character(0) > try(system("convert tmp/4hu3m1322218559.ps tmp/4hu3m1322218559.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.327 0.202 1.532