R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(10284.5,12792,12823.61538,13845.66667,15335.63636,11188.5,13633.25,12298.46667,15353.63636,12696.15385,12213.93333,13683.72727,11214.14286,13950.23077,11179.13333,11801.875,11188.82353,16456.27273,11110.0625,16530.69231,10038.41176,11681.25,11148.88235,8631,9386.444444,9764.736842,12043.75,12948.06667,10987.125,11648.3125,10633.35294,10219.3,9037.6,10296.31579,11705.41176,10681.94444,9362.947368,11306.35294,10984.45,10062.61905,8118.583333,8867.48,8346.72,8529.307692,10697.18182,8591.84,8695.607143,8125.571429,7009.758621,7883.466667,7527.645161,6763.758621,6682.333333,7855.681818,6738.88,7895.434783,6361.884615,6935.956522,8344.454545,9107.944444) > 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 -1468.57422 12746.397 -993.32299 Feb 1 312.43593 12793.733 -314.16862 Mar 1 178.00907 12841.068 -195.46186 Apr 1 408.82610 12877.435 559.40529 May 1 -154.93354 12913.802 2576.76749 Jun 1 641.63819 12942.467 -2395.60503 Jul 1 -413.33862 12971.131 1075.45734 Aug 1 652.24217 12984.510 -1338.28515 Sep 1 -81.26357 12997.888 2437.01190 Oct 1 -247.81602 12939.819 4.15059 Nov 1 224.42506 12881.751 -892.24226 Dec 1 -51.65037 12843.843 891.53482 Jan 2 -1468.57422 12805.935 -123.21801 Feb 2 312.43593 12781.591 856.20356 Mar 2 178.00907 12757.247 -1756.12322 Apr 2 408.82610 12638.052 -1245.00280 May 2 -154.93354 12518.856 -1175.09885 Jun 2 641.63819 12322.328 3492.30622 Jul 2 -413.33862 12125.801 -602.39960 Aug 2 652.24217 11948.457 3929.99277 Sep 2 -81.26357 11771.114 -1651.43869 Oct 2 -247.81602 11645.875 283.19063 Nov 2 224.42506 11520.637 -596.17947 Dec 2 -51.65037 11349.259 -2666.60816 Jan 3 -1468.57422 11177.880 -322.86162 Feb 3 312.43593 11002.688 -1550.38750 Mar 3 178.00907 10827.497 1038.24438 Apr 3 408.82610 10769.699 1769.54156 May 3 -154.93354 10711.901 430.15706 Jun 3 641.63819 10733.071 273.60296 Jul 3 -413.33862 10754.241 292.45034 Aug 3 652.24217 10737.763 -1170.70502 Sep 3 -81.26357 10721.284 -1602.42093 Oct 3 -247.81602 10596.610 -52.47794 Nov 3 224.42506 10471.935 1009.05169 Dec 3 -51.65037 10309.159 424.43625 Jan 4 -1468.57422 10146.382 685.13949 Feb 4 312.43593 10008.691 985.22619 Mar 4 178.00907 9871.000 935.44137 Apr 4 408.82610 9716.765 -62.97171 May 4 -154.93354 9562.530 -1289.01289 Jun 4 641.63819 9352.729 -1126.88753 Jul 4 -413.33862 9142.929 -382.87029 Aug 4 652.24217 8922.225 -1045.15920 Sep 4 -81.26357 8701.521 2076.92485 Oct 4 -247.81602 8508.635 331.02080 Nov 4 224.42506 8315.750 155.43219 Dec 4 -51.65037 8153.138 24.08342 Jan 5 -1468.57422 7990.527 487.80599 Feb 5 312.43593 7810.391 -239.36051 Mar 5 178.00907 7630.256 -280.61957 Apr 5 408.82610 7571.841 -1216.90824 May 5 -154.93354 7513.426 -676.15900 Jun 5 641.63819 7495.899 -281.85584 Jul 5 -413.33862 7478.373 -326.15445 Aug 5 652.24217 7475.301 -232.10869 Sep 5 -81.26357 7472.230 -1029.08136 Oct 5 -247.81602 7486.865 -303.09245 Nov 5 224.42506 7501.500 618.52904 Dec 5 -51.65037 7533.750 1625.84523 > 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/www/html/rcomp/tmp/1ezqj1259888078.ps",horizontal=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/html/rcomp/tmp/22dmn1259888078.ps",horizontal=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/html/rcomp/tmp/31q731259888078.ps",horizontal=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/html/rcomp/tmp/4ptnn1259888078.ps",horizontal=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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/596ng1259888078.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/html/rcomp/tmp/6515k1259888078.tab") > system("convert tmp/1ezqj1259888078.ps tmp/1ezqj1259888078.png") > system("convert tmp/22dmn1259888078.ps tmp/22dmn1259888078.png") > system("convert tmp/31q731259888078.ps tmp/31q731259888078.png") > system("convert tmp/4ptnn1259888078.ps tmp/4ptnn1259888078.png") > > > proc.time() user system elapsed 0.947 0.608 1.155