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(12008,9169,8788,8417,8247,8197,8236,8253,7733,8366,8626,8863,10102,8463,9114,8563,8872,8301,8301,8278,7736,7973,8268,9476,11100,8962,9173,8738,8459,8078,8411,8291,7810,8616,8312,9692,9911,8915,9452,9112,8472,8230,8384,8625,8221,8649,8625,10443,10357,8586,8892,8329,8101,7922,8120,7838,7735,8406,8209,9451,10041,9411,10405,8467,8464,8102,7627,7513,7510,8291,8064,9383,9706,8579,9474,8318,8213,8059,9111,7708,7680,8014,8007,8718,9486,9113,9025,8476,7952,7759,7835,7600,7651,8319,8812,8630) > 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 1665.30645 9099.684 1243.010050 Feb 1 236.65795 9032.127 -99.785295 Mar 1 637.75969 8964.571 -814.330865 Apr 1 -93.17707 8898.996 -388.819225 May 1 -291.23873 8833.421 -295.182688 Jun 1 -549.31981 8767.583 -21.262699 Jul 1 -368.77585 8701.744 -96.967759 Aug 1 -601.95250 8644.923 210.029442 Sep 1 -849.00424 8588.103 -6.098281 Oct 1 -276.97438 8583.250 59.724653 Nov 1 -238.56984 8578.397 286.172896 Dec 1 729.28836 8589.844 -456.132675 Jan 2 1665.30645 8601.292 -164.598146 Feb 2 236.65795 8608.502 -382.159687 Mar 2 637.75969 8615.712 -139.471454 Apr 2 -93.17707 8619.488 36.689559 May 2 -291.23873 8623.263 539.975468 Jun 2 -549.31981 8648.144 202.175589 Jul 2 -368.77585 8673.025 -3.249337 Aug 2 -601.95250 8700.078 179.874432 Sep 2 -849.00424 8727.131 -142.126722 Oct 2 -276.97438 8730.738 -480.763211 Nov 2 -238.56984 8734.344 -227.774390 Dec 2 729.28836 8729.963 16.748743 Jan 3 1665.30645 8725.582 709.111977 Feb 3 236.65795 8736.367 -11.024773 Mar 3 637.75969 8747.152 -211.911748 Apr 3 -93.17707 8758.228 72.948739 May 3 -291.23873 8769.305 -19.065878 Jun 3 -549.31981 8759.743 -132.423028 Jul 3 -368.77585 8750.181 29.594773 Aug 3 -601.95250 8738.697 154.255467 Sep 3 -849.00424 8727.213 -68.208763 Oct 3 -276.97438 8734.695 158.279479 Nov 3 -238.56984 8742.177 -191.606970 Dec 3 729.28836 8753.330 209.381596 Jan 4 1665.30645 8764.483 -518.789738 Feb 4 236.65795 8782.277 -103.934674 Mar 4 637.75969 8800.070 14.170165 Apr 4 -93.17707 8829.481 375.696165 May 4 -291.23873 8858.892 -95.652938 Jun 4 -549.31981 8890.525 -111.204826 Jul 4 -368.77585 8922.158 -169.381763 Aug 4 -601.95250 8919.322 307.630708 Sep 4 -849.00424 8916.486 153.518255 Oct 4 -276.97438 8877.739 48.235250 Nov 4 -238.56984 8838.992 24.577554 Dec 4 729.28836 8791.877 921.834934 Jan 5 1665.30645 8744.761 -53.067585 Feb 5 236.65795 8694.870 -345.527631 Mar 5 637.75969 8644.978 -390.737902 Apr 5 -93.17707 8599.825 -177.647457 May 5 -291.23873 8554.671 -162.432115 Jun 5 -549.31981 8533.681 -62.360731 Jul 5 -368.77585 8512.690 -23.914395 Aug 5 -601.95250 8546.415 -106.462781 Sep 5 -849.00424 8580.140 3.863909 Oct 5 -276.97438 8630.037 52.937215 Nov 5 -238.56984 8679.934 -232.364169 Dec 5 729.28836 8696.655 25.057054 Jan 6 1665.30645 8713.375 -337.681622 Feb 6 236.65795 8697.753 476.589427 Mar 6 637.75969 8682.130 1085.110251 Apr 6 -93.17707 8657.257 -97.079918 May 6 -291.23873 8632.384 122.854809 Jun 6 -549.31981 8594.258 57.061571 Jul 6 -368.77585 8556.133 -560.356716 Aug 6 -601.95250 8507.374 -392.421368 Sep 6 -849.00424 8458.615 -99.610944 Oct 6 -276.97438 8433.254 134.720735 Nov 6 -238.56984 8407.892 -105.322278 Dec 6 729.28836 8432.760 220.951639 Jan 7 1665.30645 8457.628 -416.934344 Feb 7 236.65795 8491.378 -149.035934 Mar 7 637.75969 8525.128 311.112251 Apr 7 -93.17707 8530.968 -119.790436 May 7 -291.23873 8536.807 -32.568227 Jun 7 -549.31981 8519.361 88.959090 Jul 7 -368.77585 8501.914 977.861359 Aug 7 -601.95250 8485.135 -175.182420 Sep 7 -849.00424 8468.355 60.648878 Oct 7 -276.97438 8445.576 -154.601503 Nov 7 -238.56984 8422.796 -177.226576 Dec 7 729.28836 8390.650 -401.938420 Jan 8 1665.30645 8358.504 -537.810165 Feb 8 236.65795 8339.368 536.974530 Mar 8 637.75969 8320.231 67.009000 Apr 8 -93.17707 8341.268 227.908841 May 8 -291.23873 8362.305 -119.066422 Jun 8 -549.31981 8376.770 -68.450124 Jul 8 -368.77585 8391.235 -187.458875 Aug 8 -601.95250 8403.534 -201.581116 Sep 8 -849.00424 8415.833 84.171719 Oct 8 -276.97438 8428.557 167.417485 Nov 8 -238.56984 8441.281 609.288560 Dec 8 729.28836 8454.683 -553.971597 > m$win s t l 961 19 13 > m$deg s t l 0 1 1 > m$jump s t l 97 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1igrv1353681532.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/27day1353681532.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/3veg71353681532.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/4p7cw1353681532.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/5vy8c1353681532.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/6mkj91353681533.tab") > > try(system("convert tmp/1igrv1353681532.ps tmp/1igrv1353681532.png",intern=TRUE)) character(0) > try(system("convert tmp/27day1353681532.ps tmp/27day1353681532.png",intern=TRUE)) character(0) > try(system("convert tmp/3veg71353681532.ps tmp/3veg71353681532.png",intern=TRUE)) character(0) > try(system("convert tmp/4p7cw1353681532.ps tmp/4p7cw1353681532.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.578 0.388 2.947