R version 2.11.1 (2010-05-31) Copyright (C) 2010 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(94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3,91,93.2,103.1,94.1,91.8,102.7,82.6,89.1,104.5,105.1,95.1,88.7,86.3,91.8,111.5,99.7,97.5,111.7,86.2,95.4) > 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 -5.0179561 98.49831 1.11964526 Feb 1 -3.1037727 98.98142 0.02235320 Mar 1 7.4104075 99.46453 -2.17493565 Apr 1 0.2241794 99.95924 2.61658433 May 1 -0.6787156 100.45394 -1.67522886 Jun 1 9.3262288 100.95961 3.61416482 Jul 1 -16.1188181 101.46527 -4.44645028 Aug 1 -6.0181268 101.97133 -0.25320780 Sep 1 8.6581110 102.47740 2.06448830 Oct 1 9.4156223 102.96782 -6.48344065 Nov 1 2.1931285 103.45824 3.14863559 Dec 1 -6.2902874 103.86961 4.72067678 Jan 2 -5.0179561 104.28099 -0.26302925 Feb 2 -3.1037727 104.63512 -0.83134373 Mar 2 7.4104075 104.98925 3.10034500 Apr 2 0.2241794 105.30777 -4.83195377 May 2 -0.6787156 105.62630 4.95241427 Jun 2 9.3262288 105.96120 -0.68743218 Jul 2 -16.1188181 106.29611 -4.77728742 Aug 2 -6.0181268 106.68465 -0.16652064 Sep 2 8.6581110 107.07319 -0.93130024 Oct 2 9.4156223 107.42181 -0.33743683 Nov 2 2.1931285 107.77044 2.93643178 Dec 2 -6.2902874 108.07292 0.21736974 Jan 3 -5.0179561 108.37540 2.64256048 Feb 3 -3.1037727 108.58408 -0.18030367 Mar 3 7.4104075 108.79276 2.59683539 Apr 3 0.2241794 108.87080 -2.99497765 May 3 -0.6787156 108.94884 1.02987613 Jun 3 9.3262288 109.06095 -1.18717944 Jul 3 -16.1188181 109.17306 -0.55424379 Aug 3 -6.0181268 109.37326 0.84486695 Sep 3 8.6581110 109.57346 -5.73156870 Oct 3 9.4156223 109.80124 3.18313639 Nov 3 2.1931285 110.02902 1.07784668 Dec 3 -6.2902874 110.16807 -3.87778069 Jan 4 -5.0179561 110.30711 5.41084472 Feb 4 -3.1037727 110.26601 5.63776088 Mar 4 7.4104075 110.22491 -7.83531975 Apr 4 0.2241794 109.76619 7.30963106 May 4 -0.6787156 109.30747 0.47124869 Jun 4 9.3262288 108.32088 -1.74710496 Jul 4 -16.1188181 107.33429 4.78453261 Aug 4 -6.0181268 106.00143 -0.18330113 Sep 4 8.6581110 104.66857 3.47331874 Oct 4 9.4156223 103.22352 3.06085911 Nov 4 2.1931285 101.77847 -4.57159532 Dec 4 -6.2902874 100.42754 0.16274700 Jan 5 -5.0179561 99.07661 -3.05865790 Feb 5 -3.1037727 98.04235 -1.73857990 Mar 5 7.4104075 97.00809 -1.31849869 Apr 5 0.2241794 96.35055 -2.47472891 May 5 -0.6787156 95.69301 -3.21429230 Jun 5 9.3262288 95.34916 -1.97538658 Jul 5 -16.1188181 95.00531 3.71351037 Aug 5 -6.0181268 95.03754 0.08058989 Sep 5 8.6581110 95.06977 0.77212302 Oct 5 9.4156223 95.44593 0.23844859 Nov 5 2.1931285 95.82209 -2.91522066 Dec 5 -6.2902874 96.47661 -1.48632611 Jan 6 -5.0179561 97.13113 -5.81317878 Feb 6 -3.1037727 97.76512 -2.86134350 Mar 6 7.4104075 98.39910 5.69049499 Apr 6 0.2241794 99.07568 0.40013750 May 6 -0.6787156 99.75227 -1.57355316 Jun 6 9.3262288 100.47617 1.89760184 Jul 6 -16.1188181 101.20007 1.11874807 Aug 6 -6.0181268 101.95328 -0.53515631 > m$win s t l 681 19 13 > m$deg s t l 0 1 1 > m$jump s t l 69 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/1qyid1290882401.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/rcomp/tmp/2qyid1290882401.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/rcomp/tmp/30phy1290882401.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/rcomp/tmp/40phy1290882401.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/5pqe91290882401.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/rcomp/tmp/6srdx1290882401.tab") > > try(system("convert tmp/1qyid1290882401.ps tmp/1qyid1290882401.png",intern=TRUE)) character(0) > try(system("convert tmp/2qyid1290882401.ps tmp/2qyid1290882401.png",intern=TRUE)) character(0) > try(system("convert tmp/30phy1290882401.ps tmp/30phy1290882401.png",intern=TRUE)) character(0) > try(system("convert tmp/40phy1290882401.ps tmp/40phy1290882401.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.430 0.480 1.873