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(33,24,24,31,25,28,24,25,16,17,11,12,39,19,14,15,7,12,12,14,9,8,4,7,3,5,0,-2,6,11,9,17,21,21,41,57,65,68,73,71,71,70,69,65,57,57,57,55,65,65,64,60,43,47,40,31,27,24,23,17) > 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 9.2082580 25.254582 -1.46284011 Feb 1 4.3150379 24.888204 -5.20324172 Mar 1 3.0218161 24.521826 -3.54364162 Apr 1 3.0749374 24.074001 3.85106210 May 1 -1.4719328 23.626176 2.84575732 Jun 1 1.7778387 23.136085 3.08607656 Jul 1 -0.9723875 22.645994 2.32639359 Aug 1 -1.3545029 22.147180 4.20732330 Sep 1 -5.7366195 21.648365 0.08825418 Oct 1 -6.1872676 20.710564 2.47670333 Nov 1 -4.2379095 19.772763 -4.53485367 Dec 1 -1.4372731 18.466939 -5.02966634 Jan 2 9.2082580 17.161116 12.63062627 Feb 2 4.3150379 16.192895 -1.50793315 Mar 2 3.0218161 15.224675 -4.24649087 Apr 2 3.0749374 14.492892 -2.56782962 May 2 -1.4719328 13.761110 -5.28917686 Jun 2 1.7778387 12.765826 -2.54366501 Jul 2 -0.9723875 11.770543 1.20184462 Aug 2 -1.3545029 10.465812 4.88869078 Sep 2 -5.7366195 9.161081 5.57553811 Oct 2 -6.1872676 8.088581 6.09868613 Nov 2 -4.2379095 7.016082 1.22182801 Dec 2 -1.4372731 6.391535 2.04573788 Jan 3 9.2082580 5.766989 -11.97524697 Feb 3 4.3150379 5.967182 -5.28221960 Mar 3 3.0218161 6.167374 -9.18919052 Apr 3 3.0749374 8.002071 -13.07700829 May 3 -1.4719328 9.836767 -2.36483455 Jun 3 1.7778387 13.847726 -4.62556455 Jul 3 -0.9723875 17.858684 -7.88629678 Aug 3 -1.3545029 23.453955 -5.09945172 Sep 3 -5.7366195 29.049225 -2.31260548 Oct 3 -6.1872676 35.032586 -7.84531884 Nov 3 -4.2379095 41.015948 4.22196167 Dec 3 -1.4372731 46.398230 12.03904316 Jan 4 9.2082580 51.780512 4.01122993 Feb 4 4.3150379 55.850114 7.83484812 Mar 4 3.0218161 59.919716 10.05846801 Apr 4 3.0749374 62.145414 5.77964882 May 4 -1.4719328 64.371112 8.10082113 Jun 4 1.7778387 64.791545 3.43061616 Jul 4 -0.9723875 65.211979 4.76040897 Aug 4 -1.3545029 64.612882 1.74162079 Sep 4 -5.7366195 64.013786 -1.27716621 Oct 4 -6.1872676 62.709978 0.47728929 Nov 4 -4.2379095 61.406171 -0.16826136 Dec 4 -1.4372731 59.466413 -3.02913942 Jan 5 9.2082580 57.526654 -1.73491221 Feb 5 4.3150379 55.070619 5.61434285 Mar 5 3.0218161 52.614584 8.36359962 Apr 5 3.0749374 49.446330 7.47873296 May 5 -1.4719328 46.278075 -1.80614219 Jun 5 1.7778387 43.013398 2.20876340 Jul 5 -0.9723875 39.748721 1.22366676 Aug 5 -1.3545029 36.377246 -4.02274298 Sep 5 -5.7366195 33.005771 -0.26915154 Oct 5 -6.1872676 29.536398 0.65086937 Nov 5 -4.2379095 26.067025 1.17088414 Dec 5 -1.4372731 22.537196 -4.09992319 > 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/1clyf1291833070.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/www/html/rcomp/tmp/2clyf1291833070.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/www/html/rcomp/tmp/35ufi1291833070.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/www/html/rcomp/tmp/45ufi1291833070.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/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/5j4dr1291833070.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/645tf1291833070.tab") > > try(system("convert tmp/1clyf1291833070.ps tmp/1clyf1291833070.png",intern=TRUE)) character(0) > try(system("convert tmp/2clyf1291833070.ps tmp/2clyf1291833070.png",intern=TRUE)) character(0) > try(system("convert tmp/35ufi1291833070.ps tmp/35ufi1291833070.png",intern=TRUE)) character(0) > try(system("convert tmp/45ufi1291833070.ps tmp/45ufi1291833070.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.993 0.657 4.173