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(6.3,6.2,6.1,6.3,6.5,6.6,6.5,6.2,6.2,5.9,6.1,6.1,6.1,6.1,6.1,6.4,6.7,6.9,7,7,6.8,6.4,5.9,5.5,5.5,5.6,5.8,5.9,6.1,6.1,6,6,5.9,5.5,5.6,5.4,5.2,5.2,5.2,5.5,5.8,5.8,5.5,5.3,5.1,5.2,5.8,5.8,5.5,5,4.9,5.3,6.1,6.5,6.8,6.6,6.4,6.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 -0.25569215 6.434075 0.1216167712 Feb 1 -0.35431138 6.401495 0.1528168313 Mar 1 -0.35293069 6.368914 0.0840169781 Apr 1 -0.09486549 6.342000 0.0528651051 May 1 0.26319963 6.315087 -0.0782866812 Jun 1 0.39912845 6.293043 -0.0921709656 Jul 1 0.37505726 6.270998 -0.1460552500 Aug 1 0.23446932 6.251309 -0.2857786084 Sep 1 0.09388123 6.231621 -0.1255018223 Oct 1 -0.11121847 6.233860 -0.2226414888 Nov 1 -0.02476878 6.236099 -0.1113305508 Dec 1 -0.17194873 6.271523 0.0004255914 Jan 2 -0.25569215 6.306947 0.0487452052 Feb 2 -0.35431138 6.356117 0.0981948610 Mar 2 -0.35293069 6.405286 0.0476446035 Apr 2 -0.09486549 6.432051 0.0628142361 May 2 0.26319963 6.458816 -0.0220160445 Jun 2 0.39912845 6.437212 0.0636599695 Jul 2 0.37505726 6.415607 0.2093359835 Aug 2 0.23446932 6.368547 0.3969839551 Sep 2 0.09388123 6.321487 0.3846320713 Oct 2 -0.11121847 6.266151 0.2450670603 Nov 2 -0.02476878 6.210816 -0.2860473462 Dec 2 -0.17194873 6.140021 -0.4680727307 Jan 3 -0.25569215 6.069227 -0.3135346436 Feb 3 -0.35431138 5.996430 -0.0421186637 Mar 3 -0.35293069 5.923633 0.2292974030 Apr 3 -0.09486549 5.874827 0.1200381348 May 3 0.26319963 5.826021 0.0107789535 Jun 3 0.39912845 5.795616 -0.0947439949 Jul 3 0.37505726 5.765210 -0.1402669434 Aug 3 0.23446932 5.730355 0.0351756502 Sep 3 0.09388123 5.695500 0.1106183884 Oct 3 -0.11121847 5.662349 -0.0511300966 Nov 3 -0.02476878 5.629197 -0.0044279769 Dec 3 -0.17194873 5.596588 -0.0246393620 Jan 4 -0.25569215 5.563979 -0.1082872756 Feb 4 -0.35431138 5.520177 0.0341342773 Mar 4 -0.35293069 5.476375 0.0765559170 Apr 4 -0.09486549 5.448077 0.1467881725 May 4 0.26319963 5.419780 0.1170205148 Jun 4 0.39912845 5.422106 -0.0212348559 Jul 4 0.37505726 5.424433 -0.2994902265 Aug 4 0.23446932 5.428386 -0.3628553293 Sep 4 0.09388123 5.432339 -0.4262202875 Oct 4 -0.11121847 5.443564 -0.1323454937 Nov 4 -0.02476878 5.454789 0.3699799048 Dec 4 -0.17194873 5.510826 0.4611230851 Jan 5 -0.25569215 5.566862 0.1888297369 Feb 5 -0.35431138 5.664212 -0.3099004571 Mar 5 -0.35293069 5.761561 -0.5086305644 Apr 5 -0.09486549 5.853793 -0.4589271307 May 5 0.26319963 5.946024 -0.1092236102 Jun 5 0.39912845 6.038955 0.0619163304 Jul 5 0.37505726 6.131886 0.2930562710 Aug 5 0.23446932 6.229207 0.1363233135 Sep 5 0.09388123 6.326528 -0.0204094994 Oct 5 -0.11121847 6.427257 0.0839611452 > m$win s t l 581 19 13 > m$deg s t l 0 1 1 > m$jump s t l 59 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1vvk41259941560.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/26nb61259941560.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/3w9bw1259941560.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/4h8eb1259941560.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/5zj661259941560.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/60nz11259941560.tab") > system("convert tmp/1vvk41259941560.ps tmp/1vvk41259941560.png") > system("convert tmp/26nb61259941560.ps tmp/26nb61259941560.png") > system("convert tmp/3w9bw1259941560.ps tmp/3w9bw1259941560.png") > system("convert tmp/4h8eb1259941560.ps tmp/4h8eb1259941560.png") > > > proc.time() user system elapsed 0.967 0.618 1.266