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(5594,5585,5710,5511,5403,5826,5884,5965,5960,6064,6046,5954,5952,5960,5983,5996,6021,6094,6202,6276,6306,6342,6345,6328,6191,6261,6253,6198,6247,6293,6381,6448,6470,6516,6532,6526,6533,6498,6507,6464,6453,6468,6497,6808,6793,6907,6792,6757,6734,6654,6589,6469,6521,6448,6410,6528,6445,6458,6215,6167) > 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 -23.95656 5610.573 7.3837899 Feb 1 -48.41174 5643.547 -10.1353467 Mar 1 -46.86698 5676.521 80.3455683 Apr 1 -136.53356 5709.130 -61.5964774 May 1 -144.00018 5741.739 -194.7384872 Jun 1 -54.49253 5773.740 106.7528087 Jul 1 -12.78477 5805.741 91.0440009 Aug 1 111.27929 5837.944 15.7764116 Sep 1 94.94336 5870.148 -5.0911926 Oct 1 152.13528 5903.738 8.1264432 Nov 1 75.32726 5937.329 33.3440224 Dec 1 33.36107 5969.084 -48.4455095 Jan 2 -23.95656 6000.840 -24.8836032 Feb 2 -48.41174 6028.747 -20.3357235 Mar 2 -46.86698 6056.655 -26.7877921 Apr 2 -136.53356 6083.896 48.6371899 May 2 -144.00018 6111.138 53.8622077 Jun 2 -54.49253 6136.509 11.9831883 Jul 2 -12.78477 6161.881 52.9040653 Aug 2 111.27929 6183.862 -19.1417186 Sep 2 94.94336 6205.844 5.2124827 Oct 2 152.13528 6224.349 -34.4839553 Nov 2 75.32726 6242.853 26.8195500 Dec 2 33.36107 6259.809 34.8299039 Jan 3 -23.95656 6276.765 -61.8083040 Feb 3 -48.41174 6292.217 17.1947036 Mar 3 -46.86698 6307.669 -7.8022373 Apr 3 -136.53356 6322.600 11.9330787 May 3 -144.00018 6337.532 53.4684305 Jun 3 -54.49253 6355.324 -7.8316596 Jul 3 -12.78477 6373.117 20.6681466 Aug 3 111.27929 6393.971 -57.2506039 Sep 3 94.94336 6414.826 -39.7693694 Oct 3 152.13528 6435.517 -71.6522083 Nov 3 75.32726 6456.208 0.4648961 Dec 3 33.36107 6475.621 17.0181600 Jan 4 -23.95656 6495.034 61.9228621 Feb 4 -48.41174 6517.375 29.0362587 Mar 4 -46.86698 6539.717 14.1497069 Apr 4 -136.53356 6563.520 37.0134331 May 4 -144.00018 6587.323 9.6771951 Jun 4 -54.49253 6607.560 -85.0677051 Jul 4 -12.78477 6627.797 -118.0127090 Aug 4 111.27929 6641.813 54.9079241 Sep 4 94.94336 6655.828 42.2285424 Oct 4 152.13528 6663.376 91.4890121 Nov 4 75.32726 6670.923 45.7494250 Dec 4 33.36107 6667.081 56.5576296 Jan 5 -23.95656 6663.239 94.7172723 Feb 5 -48.41174 6642.351 60.0608885 Mar 5 -46.86698 6621.462 14.4045562 Apr 5 -136.53356 6575.617 29.9164796 May 5 -144.00018 6529.772 135.2284389 Jun 5 -54.49253 6481.758 20.7343327 Jul 5 -12.78477 6433.745 -10.9598771 Aug 5 111.27929 6384.220 32.5007108 Sep 5 94.94336 6334.695 15.3612838 Oct 5 152.13528 6283.453 22.4116347 Nov 5 75.32726 6232.211 -92.5380712 Dec 5 33.36107 6179.598 -45.9589676 > 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/1o1gs1259932787.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/2oeih1259932787.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/3iqu81259932787.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/4pzu81259932787.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/59fq11259932787.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/6jnyv1259932787.tab") > > system("convert tmp/1o1gs1259932787.ps tmp/1o1gs1259932787.png") > system("convert tmp/2oeih1259932787.ps tmp/2oeih1259932787.png") > system("convert tmp/3iqu81259932787.ps tmp/3iqu81259932787.png") > system("convert tmp/4pzu81259932787.ps tmp/4pzu81259932787.png") > > > proc.time() user system elapsed 0.956 0.585 1.549