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(13328,12873,14000,13477,14237,13674,13529,14058,12975,14326,14008,16193,14483,14011,15057,14884,15414,14440,14900,15074,14442,15307,14938,17193,15528,14765,15838,15723,16150,15486,15986,15983,15692,16490,15686,18897,16316,15636,17163,16534,16518,16375,16290,16352,15943,16362,16393,19051,16747,16320,17910,16961,17480,17049,16879,17473,16998,17307,17418,20169,17871,17226,19062,17804,19100,18522,18060,18869,18127,18871,18890,21263,19547,18450,20254,19240,20216,19420,19415,20018,18652,19978,19509,21971) > 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 -99.33842 13457.80 -30.458242 Feb 1 -831.41341 13539.45 164.961502 Mar 1 513.94006 13621.11 -135.047223 Apr 1 -219.38922 13704.21 -7.824961 May 1 354.85252 13787.32 94.826273 Jun 1 -297.52501 13872.40 99.121405 Jul 1 -343.90262 13957.49 -84.583384 Aug 1 -10.34012 14044.11 24.229140 Sep 1 -786.20558 14130.74 -369.530373 Oct 1 -30.85734 14223.33 133.527131 Nov 1 -362.79428 14315.92 54.869821 Dec 1 2112.97343 14414.58 -334.554192 Jan 2 -99.33842 14513.24 69.101350 Feb 2 -831.41341 14613.26 229.149702 Mar 2 513.94006 14713.29 -170.230413 Apr 2 -219.38922 14805.76 297.625832 May 2 354.85252 14898.24 160.911051 Jun 2 -297.52501 14977.58 -240.055341 Jul 2 -343.90262 15056.92 186.978345 Aug 2 -10.34012 15125.05 -40.713984 Sep 2 -786.20558 15193.18 35.021650 Oct 2 -30.85734 15260.91 76.944493 Nov 2 -362.79428 15328.64 -27.847477 Dec 2 2112.97343 15405.16 -325.133046 Jan 3 -99.33842 15481.68 145.660939 Feb 3 -831.41341 15570.45 25.958450 Mar 3 513.94006 15659.23 -335.172508 Apr 3 -219.38922 15755.50 186.886478 May 3 354.85252 15851.77 -56.625564 Jun 3 -297.52501 15948.57 -165.045134 Jul 3 -343.90262 16045.37 284.535374 Aug 3 -10.34012 16132.78 -139.443365 Sep 3 -786.20558 16220.20 258.005858 Oct 3 -30.85734 16290.05 230.806487 Nov 3 -362.79428 16359.90 -311.107699 Dec 3 2112.97343 16406.14 377.883379 Jan 4 -99.33842 16452.38 -37.045988 Feb 4 -831.41341 16478.35 -10.938038 Mar 4 513.94006 16504.32 144.741445 Apr 4 -219.38922 16522.70 230.684878 May 4 354.85252 16541.09 -377.942715 Jun 4 -297.52501 16567.34 105.182606 Jul 4 -343.90262 16593.59 40.308005 Aug 4 -10.34012 16638.21 -275.867492 Sep 4 -786.20558 16682.82 46.384974 Oct 4 -30.85734 16742.86 -349.997733 Nov 4 -362.79428 16802.89 -47.095253 Dec 4 2112.97343 16872.49 65.532974 Jan 5 -99.33842 16942.10 -95.759244 Feb 5 -831.41341 17019.62 131.791367 Mar 5 513.94006 17097.15 298.913511 Apr 5 -219.38922 17179.31 1.082936 May 5 354.85252 17261.47 -136.318666 Jun 5 -297.52501 17343.83 2.697490 Jul 5 -343.90262 17426.19 -203.286275 Aug 5 -10.34012 17513.38 -30.041208 Sep 5 -786.20558 17600.57 183.631822 Oct 5 -30.85734 17701.72 -363.863737 Nov 5 -362.79428 17802.87 -22.074110 Dec 5 2112.97343 17916.30 139.726646 Jan 6 -99.33842 18029.73 -59.393044 Feb 6 -831.41341 18143.48 -86.068794 Mar 6 513.94006 18257.23 290.826989 Apr 6 -219.38922 18370.00 -346.606971 May 6 354.85252 18482.76 262.388042 Jun 6 -297.52501 18595.78 223.742397 Jul 6 -343.90262 18708.81 -304.903171 Aug 6 -10.34012 18818.97 60.368394 Sep 6 -786.20558 18929.14 -15.932079 Oct 6 -30.85734 19033.61 -131.755407 Nov 6 -362.79428 19138.09 114.706451 Dec 6 2112.97343 19235.82 -85.789431 Jan 7 -99.33842 19333.54 312.794243 Feb 7 -831.41341 19419.75 -138.339049 Mar 7 513.94006 19505.96 234.099191 Apr 7 -219.38922 19561.33 -101.939841 May 7 354.85252 19616.70 244.450100 Jun 7 -297.52501 19669.64 47.889538 Jul 7 -343.90262 19722.57 36.329054 Aug 7 -10.34012 19773.19 255.154295 Sep 7 -786.20558 19823.80 -385.592502 Oct 7 -30.85734 19871.33 137.530610 Nov 7 -362.79428 19918.86 -47.061091 Dec 7 2112.97343 19964.19 -106.168306 > m$win s t l 841 19 13 > m$deg s t l 0 1 1 > m$jump s t l 85 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1l73u1322605534.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/2wpe71322605534.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/3g1wz1322605534.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/4bems1322605534.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/5w8c41322605534.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/6i4nx1322605534.tab") > > try(system("convert tmp/1l73u1322605534.ps tmp/1l73u1322605534.png",intern=TRUE)) character(0) > try(system("convert tmp/2wpe71322605534.ps tmp/2wpe71322605534.png",intern=TRUE)) character(0) > try(system("convert tmp/3g1wz1322605534.ps tmp/3g1wz1322605534.png",intern=TRUE)) character(0) > try(system("convert tmp/4bems1322605534.ps tmp/4bems1322605534.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.484 0.223 1.736