R version 2.12.0 (2010-10-15) Copyright (C) 2010 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 = '6' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > 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 -81.011651 13404.32 4.6956181 Feb 1 -722.806028 13496.04 99.7612221 Mar 1 419.097786 13587.77 -6.8713656 Apr 1 -68.648345 13679.50 -133.8540068 May 1 338.457074 13772.07 126.4753653 Jun 1 -346.167977 13864.63 155.5352067 Jul 1 -273.031996 13957.20 -155.1659827 Aug 1 -95.099412 14050.14 102.9605205 Sep 1 -790.226982 14143.08 -377.8528221 Oct 1 -19.768427 14236.02 109.7477098 Nov 1 -426.859504 14328.59 106.2725715 Dec 1 2069.083569 14421.15 -297.2367179 Jan 2 -83.180783 14513.72 52.4614179 Feb 2 -728.409827 14603.39 136.0167511 Mar 2 439.585156 14693.07 -75.6519428 Apr 2 -72.033135 14782.74 173.2926387 May 2 324.474965 14866.03 223.4910207 Jun 2 -340.800427 14949.33 -168.5271051 Jul 2 -281.870133 15032.62 149.2490837 Aug 2 -101.709997 15110.86 64.8516685 Sep 2 -777.830286 15189.10 30.7346778 Oct 2 -43.272187 15267.33 82.9392994 Nov 2 -430.179108 15348.89 19.2845399 Dec 2 2085.667483 15430.46 -323.1237330 Jan 3 -82.788820 15512.02 98.7708886 Feb 3 -735.830235 15598.23 -97.3951326 Mar 3 475.564957 15684.43 -321.9977607 Apr 3 -72.091486 15770.64 24.4512457 May 3 305.222849 15854.15 -9.3717103 Jun 3 -337.929649 15937.66 -113.7278346 Jul 3 -291.013526 16021.17 255.8474212 Aug 3 -112.711607 16095.17 0.5465145 Sep 3 -745.489607 16169.16 268.3255281 Oct 3 -83.642981 16243.16 330.4799141 Nov 3 -438.673302 16299.12 -174.4479074 Dec 3 2116.385167 16355.08 425.5354799 Jan 4 -86.137635 16411.04 -8.8998612 Feb 4 -768.617685 16449.29 -44.6709289 Mar 4 570.547562 16487.54 104.9127070 Apr 4 -96.754890 16525.79 104.9640407 May 4 245.406894 16562.22 -289.6228505 Jun 4 -310.488704 16598.64 86.8476394 Jul 4 -329.298194 16635.07 -15.7679792 Aug 4 -140.153282 16681.10 -188.9423697 Sep 4 -669.984754 16727.13 -114.1403770 Oct 4 -183.459639 16773.15 -227.6949719 Nov 4 -459.548308 16833.00 19.5520747 Dec 4 2223.134441 16892.84 -64.9722961 Jan 5 -66.836945 16952.68 -138.8425332 Feb 5 -822.518156 17028.28 114.2371750 Mar 5 663.616170 17103.88 142.5013448 Apr 5 -206.698240 17179.48 -11.7857486 May 5 338.804738 17266.69 -125.4932756 Jun 5 -256.494465 17353.89 -48.3986214 Jul 5 -398.324883 17441.10 -163.7727535 Aug 5 -59.307712 17535.88 -3.5699069 Sep 5 -770.882791 17630.66 138.2251881 Oct 5 -173.211934 17725.44 -245.2256517 Nov 5 -417.314847 17828.49 6.8254189 Dec 5 2165.071864 17931.54 72.3868652 Jan 6 -58.813089 18034.59 -104.7800252 Feb 6 -843.539052 18145.87 -76.3342889 Mar 6 694.773428 18257.15 110.0730037 Apr 6 -239.210711 18368.43 -325.2230852 May 6 369.581656 18479.63 250.7919871 Jun 6 -242.415670 18590.82 173.5967529 Jul 6 -415.543156 18702.01 -226.4683225 Aug 6 -26.413735 18808.27 87.1476134 Sep 6 -812.284720 18914.52 24.7639554 Oct 6 -166.475642 19020.78 16.7002343 Nov 6 -405.995104 19112.21 183.7886338 Dec 6 2142.805352 19203.64 -83.4428857 Jan 7 -57.231692 19295.07 309.1630961 Feb 7 -852.795925 19369.05 -66.2559544 Mar 7 713.146445 19443.04 97.8183924 Apr 7 -259.966913 19517.02 -17.0515331 May 7 388.572291 19589.04 238.3924190 Jun 7 -233.209240 19661.05 -7.8428943 Jul 7 -429.503136 19733.07 111.4341574 Aug 7 -9.835812 19802.96 224.8779231 Sep 7 -831.083869 19872.85 -389.7629309 Oct 7 -166.125958 19942.74 201.3902470 Nov 7 -398.553113 20010.29 -102.7408696 Dec 7 2129.403190 20077.85 -236.2554431 > m$win s t l 6 25 13 > m$deg s t l 0 1 1 > m$jump s t l 1 3 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/1p6li1322560915.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/www/rcomp/tmp/2fa9b1322560915.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/www/rcomp/tmp/3er7g1322560915.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/www/rcomp/tmp/4biwg1322560915.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/5r2ji1322560915.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/rcomp/tmp/6ay6z1322560915.tab") > > try(system("convert tmp/1p6li1322560915.ps tmp/1p6li1322560915.png",intern=TRUE)) character(0) > try(system("convert tmp/2fa9b1322560915.ps tmp/2fa9b1322560915.png",intern=TRUE)) character(0) > try(system("convert tmp/3er7g1322560915.ps tmp/3er7g1322560915.png",intern=TRUE)) character(0) > try(system("convert tmp/4biwg1322560915.ps tmp/4biwg1322560915.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.500 0.060 1.559