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(10.9,10,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9,9,9,9.8,10,9.8,9.3,9,9,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.7,7.9,7.9,8,7.9,7.6,7.1,6.8,6.5,6.9,8.2,8.7,8.3,7.9,7.5,7.8,8.3,8.4,8.2,7.7,7.2,7.3,8.1,8.5) > 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 0.52555051 9.749614 0.624835617 Feb 1 0.11594800 9.719343 0.164709180 Mar 1 -0.23365448 9.689072 -0.255417283 Apr 1 -0.10288402 9.662183 -0.359299148 May 1 0.10788630 9.635295 -0.243180883 Jun 1 0.11262671 9.608669 -0.121295674 Jul 1 -0.06263281 9.582043 -0.019410543 Aug 1 -0.29688726 9.557857 -0.160969679 Sep 1 -0.55114188 9.533671 -0.082528658 Oct 1 -0.50795657 9.530511 -0.022554363 Nov 1 0.33522867 9.527351 0.237419998 Dec 1 0.55791681 9.515746 0.226337197 Jan 2 0.52555051 9.504141 0.170308821 Feb 2 0.11594800 9.488254 -0.004201859 Mar 2 -0.23365448 9.472367 -0.038712565 Apr 2 -0.10288402 9.456082 -0.053198032 May 2 0.10788630 9.439797 -0.147683367 Jun 2 0.11262671 9.420422 -0.133048584 Jul 2 -0.06263281 9.401047 -0.138413879 Aug 2 -0.29688726 9.383383 -0.086495929 Sep 2 -0.55114188 9.365720 0.185422179 Oct 2 -0.50795657 9.346591 0.161365724 Nov 2 0.33522867 9.327462 0.137309334 Dec 2 0.55791681 9.306546 0.135537660 Jan 3 0.52555051 9.285629 -0.011179589 Feb 3 0.11594800 9.263834 -0.079781586 Mar 3 -0.23365448 9.242038 -0.008383610 Apr 3 -0.10288402 9.185923 -0.083039408 May 3 0.10788630 9.129809 -0.137695076 Jun 3 0.11262671 9.015663 -0.028289305 Jul 3 -0.06263281 8.901516 0.261116387 Aug 3 -0.29688726 8.769211 0.727675905 Sep 3 -0.55114188 8.636906 0.714235580 Oct 3 -0.50795657 8.512460 0.295496496 Nov 3 0.33522867 8.388014 -0.323242522 Dec 3 0.55791681 8.245053 -0.702969809 Jan 4 0.52555051 8.102092 -0.927642670 Feb 4 0.11594800 7.946179 -0.162126672 Mar 4 -0.23365448 7.790265 0.343389299 Apr 4 -0.10288402 7.698590 0.404294473 May 4 0.10788630 7.606914 0.185199778 Jun 4 0.11262671 7.596156 -0.108782811 Jul 4 -0.06263281 7.585398 -0.422765479 Aug 4 -0.29688726 7.590468 -0.493580351 Sep 4 -0.55114188 7.595537 -0.544395065 Oct 4 -0.50795657 7.613393 -0.205436197 Nov 4 0.33522867 7.631249 0.233522737 Dec 4 0.55791681 7.694810 0.447273032 Jan 5 0.52555051 7.758372 0.016077753 Feb 5 0.11594800 7.827480 -0.043427927 Mar 5 -0.23365448 7.896588 -0.162933633 Apr 5 -0.10288402 7.907392 -0.004507802 May 5 0.10788630 7.918196 0.273918160 Jun 5 0.11262671 7.928077 0.359296390 Jul 5 -0.06263281 7.937958 0.324674542 Aug 5 -0.29688726 7.945715 0.051172232 Sep 5 -0.55114188 7.953472 -0.202329922 Oct 5 -0.50795657 7.956162 -0.148205684 Nov 5 0.33522867 7.958853 -0.194081381 Dec 5 0.55791681 7.957491 -0.015407844 > 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/1ost51259865049.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/2cuex1259865049.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/36ci11259865049.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/4cxm51259865049.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/5lppr1259865049.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/6pl651259865049.tab") > system("convert tmp/1ost51259865049.ps tmp/1ost51259865049.png") > system("convert tmp/2cuex1259865049.ps tmp/2cuex1259865049.png") > system("convert tmp/36ci11259865049.ps tmp/36ci11259865049.png") > system("convert tmp/4cxm51259865049.ps tmp/4cxm51259865049.png") > > > proc.time() user system elapsed 0.957 0.614 1.124