R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(9700,9081,9084,9743,8587,9731,9563,9998,9437,10038,9918,9252,9737,9035,9133,9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9687,9019,9672,9206,9069,9788,10312,10105,9863,9656,9295,9946,9701,9049,10190,9706,9765,9893,9994,10433,10073,10112,9266,9820,10097,9115,10411,9678,10408,10153,10368,10581,10597,10680,9738,9556,9563,9998,9437,10038,9918,9252,9737,9035,9133,9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9687,9019,9672,9206,9069,9788,10312,10105,9863,9656,9295,9946,9701,9049,10190,9706,9765,9893,9994,10433,10073,10112,9266,9820,10097,9115,10411,9678,10408,10153,10368,10581,10597,10680,9738,9556) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > par8 <- 'FALSE' > par7 <- '1' > par6 <- '' > par5 <- '1' > par4 <- '' > par3 <- '0' > par2 <- 'periodic' > par1 <- '12' > #'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 192.711148 9448.181 59.1077698 Feb 1 -583.194377 9458.869 205.3252068 Mar 1 7.566696 9469.557 -393.1239550 Apr 1 -39.385655 9478.738 303.6473730 May 1 -390.588007 9487.919 -510.3312973 Jun 1 69.343410 9494.291 167.3652742 Jul 1 168.775005 9500.663 -106.4383324 Aug 1 193.305286 9505.594 299.1002759 Sep 1 54.919204 9510.526 -128.4447536 Oct 1 374.080102 9511.320 152.6000796 Nov 1 -69.092091 9512.114 474.9780029 Dec 1 21.559192 9487.811 -257.3698206 Jan 2 192.711148 9463.507 80.7816828 Feb 2 -583.194377 9418.051 200.1432361 Mar 2 7.566696 9372.595 -247.1618095 Apr 2 -39.385655 9337.912 188.4735389 May 2 -390.588007 9303.229 -212.6411111 Jun 2 69.343410 9288.455 269.2011828 Jul 2 168.775005 9273.682 -495.4567013 Aug 2 193.305286 9270.049 -180.3541817 Sep 2 54.919204 9266.416 -492.3352998 Oct 2 374.080102 9267.122 305.7982030 Nov 2 -69.092091 9267.827 429.2647958 Dec 2 21.559192 9271.371 25.0693895 Jan 3 192.711148 9274.916 137.3733101 Feb 3 -583.194377 9277.673 -54.4785774 Mar 3 7.566696 9280.430 -73.9970639 Apr 3 -39.385655 9283.544 322.8418296 May 3 -390.588007 9286.657 -349.0692753 Jun 3 69.343410 9293.615 -177.9585399 Jul 3 168.775005 9300.573 0.6520175 Aug 3 193.305286 9317.220 -387.5256046 Sep 3 54.919204 9333.868 -110.7868645 Oct 3 374.080102 9360.103 435.8171415 Nov 3 -69.092091 9386.338 116.7542375 Dec 3 21.559192 9408.157 225.2837083 Jan 4 192.711148 9429.976 -193.6874940 Feb 4 -583.194377 9436.325 -114.1302502 Mar 4 7.566696 9442.673 101.7603947 Apr 4 -39.385655 9458.871 267.5145518 May 4 -390.588007 9475.069 -65.4812894 Jun 4 69.343410 9505.313 97.3431276 Jul 4 168.775005 9535.558 -498.3326333 Aug 4 193.305286 9568.900 -693.2049031 Sep 4 54.919204 9602.242 130.8391893 Oct 4 374.080102 9631.412 306.5082304 Nov 4 -69.092091 9660.582 513.5103616 Dec 4 21.559192 9694.315 147.1260997 Jan 5 192.711148 9728.048 -264.7588354 Feb 5 -583.194377 9747.861 130.3328982 Mar 5 7.566696 9767.675 170.7580329 Apr 5 -39.385655 9772.983 -32.5968620 May 5 -390.588007 9778.290 -338.7017552 Jun 5 69.343410 9792.828 327.8289583 Jul 5 168.775005 9807.366 -270.1405062 Aug 5 193.305286 9826.523 -254.8284362 Sep 5 54.919204 9845.681 -7.6000039 Oct 5 374.080102 9860.695 -240.7747810 Nov 5 -69.092091 9875.709 626.3835320 Dec 5 21.559192 9892.958 158.4828340 Jan 6 192.711148 9910.207 9.0814628 Feb 6 -583.194377 9927.519 -78.3250757 Mar 6 7.566696 9944.832 -132.3982130 Apr 6 -39.385655 9965.720 170.6654305 May 6 -390.588007 9986.609 -481.0209243 Jun 6 69.343410 10021.493 320.1635852 Jul 6 168.775005 10056.377 -547.1520834 Aug 6 193.305286 10087.610 127.0848373 Sep 6 54.919204 10118.843 -20.7618798 Oct 6 374.080102 10126.437 -132.5173454 Nov 6 -69.092091 10134.032 516.0602791 Dec 6 21.559192 10119.956 455.4843143 Jan 7 192.711148 10105.881 381.4076764 Feb 7 -583.194377 10060.532 260.6619110 Mar 7 7.566696 10015.184 -466.7504533 Apr 7 -39.385655 9927.481 -325.0954168 May 7 -390.588007 9839.778 548.8096213 Jun 7 69.343410 9737.698 -370.0412150 Jul 7 168.775005 9635.617 233.6077708 Aug 7 193.305286 9562.116 162.5784816 Sep 7 54.919204 9488.615 -291.5344454 Oct 7 374.080102 9440.690 -77.7704854 Nov 7 -69.092091 9392.766 -288.6734352 Dec 7 21.559192 9358.283 -246.8422404 Jan 8 192.711148 9323.801 -29.5117188 Feb 8 -583.194377 9313.128 -29.9337716 Mar 8 7.566696 9302.456 316.9775767 Apr 8 -39.385655 9298.330 -311.9441143 May 8 -390.588007 9294.204 379.3841964 Jun 8 69.343410 9284.798 -525.1415808 Jul 8 168.775005 9275.393 502.8324640 Aug 8 193.305286 9264.103 170.5917451 Sep 8 54.919204 9252.813 10.2673884 Oct 8 374.080102 9251.977 -21.0568742 Nov 8 -69.092091 9251.140 -542.0480467 Dec 8 21.559192 9262.686 -70.2450060 Jan 9 192.711148 9274.231 100.0573615 Feb 9 -583.194377 9292.081 -161.8863212 Mar 9 7.566696 9309.930 -132.4966027 Apr 9 -39.385655 9325.165 184.2209185 May 9 -390.588007 9340.400 173.1884414 Jun 9 69.343410 9353.846 -145.1891863 Jul 9 168.775005 9367.292 633.9330081 Aug 9 193.305286 9380.760 -140.0651927 Sep 9 54.919204 9394.228 205.8529688 Oct 9 374.080102 9402.653 -347.7327247 Nov 9 -69.092091 9411.077 -602.9853281 Dec 9 21.559192 9428.588 101.8531377 Jan 10 192.711148 9446.098 48.1909304 Feb 10 -583.194377 9483.395 118.7991212 Mar 10 7.566696 9520.693 143.7407131 Apr 10 -39.385655 9558.265 -312.8797231 May 10 -390.588007 9595.838 -136.2501577 Jun 10 69.343410 9617.715 100.9419038 Jul 10 168.775005 9639.591 503.6337872 Aug 10 193.305286 9657.929 253.7654872 Sep 10 54.919204 9676.267 131.8135494 Oct 10 374.080102 9701.869 -419.9494392 Nov 10 -69.092091 9727.471 -363.3793377 Dec 10 21.559192 9746.135 178.3060730 Jan 11 192.711148 9764.798 -256.5091894 Feb 11 -583.194377 9786.317 -154.1228808 Mar 11 7.566696 9807.836 374.5968289 Apr 11 -39.385655 9830.487 -85.1012740 May 11 -390.588007 9853.137 302.4506248 Jun 11 69.343410 9861.183 -37.5259221 Jul 11 168.775005 9869.228 -44.0026470 Aug 11 193.305286 9871.755 367.9395462 Sep 11 54.919204 9874.283 143.7981017 Oct 11 374.080102 9887.813 -149.8935590 Nov 11 -69.092091 9901.344 -566.2521298 Dec 11 21.559192 9927.905 -129.4637733 Jan 12 192.711148 9954.465 -50.1760901 Feb 12 -583.194377 9995.504 -297.3092350 Mar 12 7.566696 10036.542 366.8910212 Apr 12 -39.385655 10061.040 -343.6547722 May 12 -390.588007 10085.539 713.0494362 Jun 12 69.343410 10096.306 -12.6497897 Jul 12 168.775005 10107.074 92.1508063 Aug 12 193.305286 10115.967 271.7273241 Sep 12 54.919204 10124.861 417.2202041 Oct 12 374.080102 10129.671 176.2487932 Nov 12 -69.092091 10134.482 -327.3895276 Dec 12 21.559192 10133.657 -599.2160818 > m$win s t l 1441 19 13 > m$deg s t l 0 1 1 > m$jump s t l 145 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1wlx21352753486.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/2jvoj1352753486.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/3jo8f1352753486.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/49hmj1352753486.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/555yo1352753486.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/656ht1352753486.tab") > > try(system("convert tmp/1wlx21352753486.ps tmp/1wlx21352753486.png",intern=TRUE)) character(0) > try(system("convert tmp/2jvoj1352753486.ps tmp/2jvoj1352753486.png",intern=TRUE)) character(0) > try(system("convert tmp/3jo8f1352753486.ps tmp/3jo8f1352753486.png",intern=TRUE)) character(0) > try(system("convert tmp/49hmj1352753486.ps tmp/49hmj1352753486.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.843 0.566 5.410