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(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' > #'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 1301.08166 8730.648 -120.7292759 Feb 1 325.94771 8758.336 -169.2840380 Mar 1 859.01425 8786.025 -193.0392852 Apr 1 -45.63989 8808.325 349.3152315 May 1 -341.09326 8830.624 -17.5310107 Jun 1 -559.06374 8847.235 -58.1714040 Jul 1 -350.03422 8863.846 -129.8118008 Aug 1 -708.30090 8874.692 458.6089093 Sep 1 -805.36725 8885.538 140.8292935 Oct 1 -227.68575 8863.954 12.7318986 Nov 1 -218.80451 8842.370 1.4347613 Dec 1 769.94558 8793.098 879.9564451 Jan 2 1301.08166 8743.826 312.0921382 Feb 2 325.94771 8694.198 -434.1453296 Mar 2 859.01425 8644.569 -611.5832824 Apr 2 -45.63989 8598.121 -223.4815496 May 2 -341.09326 8551.674 -109.5805756 Jun 2 -559.06374 8531.595 -50.5309407 Jul 2 -350.03422 8511.516 -41.4813093 Aug 2 -708.30090 8546.847 -0.5463287 Sep 2 -805.36725 8582.179 -41.8116741 Oct 2 -227.68575 8632.745 0.9405546 Nov 2 -218.80451 8683.311 -255.5069591 Dec 2 769.94558 8697.876 -16.8214338 Jan 3 1301.08166 8712.440 27.4781010 Feb 3 325.94771 8697.081 387.9717291 Mar 3 859.01425 8681.721 864.2648722 Apr 3 -45.63989 8655.554 -142.9140093 May 3 -341.09326 8629.387 175.7063503 Jun 3 -559.06374 8592.172 68.8913624 Jul 3 -350.03422 8554.958 -577.9236290 Aug 3 -708.30090 8507.806 -286.5049151 Sep 3 -805.36725 8460.654 -145.2865272 Oct 3 -227.68575 8435.962 82.7240736 Nov 3 -218.80451 8411.270 -128.4650679 Dec 3 769.94558 8433.981 179.0731500 Jan 4 1301.08166 8456.693 -51.7746226 Feb 4 325.94771 8490.706 -237.6536326 Mar 4 859.01425 8524.719 90.2668724 Apr 4 -45.63989 8529.264 -165.6245263 May 4 -341.09326 8533.810 20.2833161 Jun 4 -559.06374 8517.275 100.7888828 Jul 4 -350.03422 8500.740 960.2944459 Aug 4 -708.30090 8485.567 -69.2659675 Sep 4 -805.36725 8470.394 14.9732931 Oct 4 -227.68575 8448.284 -206.5981665 Nov 4 -218.80451 8426.174 -200.3693686 Dec 4 769.94558 8391.871 -443.8169133 Jan 5 1301.08166 8357.569 -172.6504487 Feb 5 325.94771 8338.695 448.3568256 Mar 5 859.01425 8319.822 -153.8363851 Apr 5 -45.63989 8338.453 183.1867926 May 5 -341.09326 8357.084 -63.9907885 Jun 5 -559.06374 8368.500 -50.4358031 Jul 5 -350.03422 8379.915 -194.8808212 Aug 5 -708.30090 8389.626 -81.3251146 Sep 5 -805.36725 8399.337 57.0302660 Oct 5 -227.68575 8409.670 137.0155584 Nov 5 -218.80451 8420.003 610.8011085 Dec 5 769.94558 8430.945 -570.8909342 > 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/1l3dv1291028702.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/2l3dv1291028702.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/3euug1291028702.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/4euug1291028702.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/5ld9a1291028702.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/6cgxm1291028702.tab") > > try(system("convert tmp/1l3dv1291028702.ps tmp/1l3dv1291028702.png",intern=TRUE)) character(0) > try(system("convert tmp/2l3dv1291028702.ps tmp/2l3dv1291028702.png",intern=TRUE)) character(0) > try(system("convert tmp/3euug1291028702.ps tmp/3euug1291028702.png",intern=TRUE)) character(0) > try(system("convert tmp/4euug1291028702.ps tmp/4euug1291028702.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.979 0.618 6.609