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(4.2,4.19,4.19,4.19,4.19,4.18,4.2,4.19,4.17,4.21,4.22,4.23,4.21,4.23,4.23,4.22,4.25,4.28,4.3,4.32,4.33,4.32,4.34,4.33,4.31,4.31,4.3,4.3,4.29,4.33,4.32,4.32,4.35,4.37,4.39,4.4,4.41,4.44,4.47,4.47,4.47,4.48,4.47,4.48,4.46,4.44,4.43,4.41,4.41,4.38,4.35,4.37,4.4,4.39,4.36,4.34,4.33,4.33,4.34,4.34,4.35,4.37,4.39,4.4,4.38,4.37,4.36,4.33,4.33,4.33,4.32,4.33,4.34) > par8 = 'TRUE' > 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.0004307551 4.184053 0.0163781352 Feb 1 0.0007235163 4.186219 0.0030576224 Mar 1 -0.0022237392 4.188385 0.0038386365 Apr 1 -0.0064565874 4.190823 0.0056333740 May 1 0.0072460626 4.193261 -0.0105073867 Jun 1 0.0111127957 4.195846 -0.0269589381 Jul 1 0.0057145993 4.198431 -0.0041455600 Aug 1 -0.0071080199 4.201046 -0.0039382825 Sep 1 -0.0085799742 4.203662 -0.0250816701 Oct 1 -0.0019402674 4.207563 0.0043768910 Nov 1 0.0015610813 4.211465 0.0069738102 Dec 1 0.0003812681 4.218150 0.0114690418 Jan 2 -0.0004307551 4.224834 -0.0144035164 Feb 2 0.0007235163 4.233847 -0.0045701457 Mar 2 -0.0022237392 4.242859 -0.0106352480 Apr 2 -0.0064565874 4.253244 -0.0267870329 May 2 0.0072460626 4.263628 -0.0208743160 Jun 2 0.0111127957 4.272894 -0.0040069548 Jul 2 0.0057145993 4.282160 0.0121253359 Aug 2 -0.0071080199 4.289779 0.0373291899 Sep 2 -0.0085799742 4.297398 0.0411823790 Oct 2 -0.0019402674 4.303133 0.0188075995 Nov 2 0.0015610813 4.308868 0.0295711780 Dec 2 0.0003812681 4.311774 0.0178443449 Jan 3 -0.0004307551 4.314681 -0.0042502782 Feb 3 0.0007235163 4.316069 -0.0067923765 Mar 3 -0.0022237392 4.317457 -0.0152329478 Apr 3 -0.0064565874 4.320978 -0.0145216272 May 3 0.0072460626 4.324500 -0.0417458048 Jun 3 0.0111127957 4.331341 -0.0124533703 Jul 3 0.0057145993 4.338181 -0.0238960064 Aug 3 -0.0071080199 4.348670 -0.0215619324 Sep 3 -0.0085799742 4.359158 -0.0005785233 Oct 3 -0.0019402674 4.372788 -0.0008482234 Nov 3 0.0015610813 4.386418 0.0020204345 Dec 3 0.0003812681 4.400123 -0.0005046064 Jan 4 -0.0004307551 4.413828 -0.0033974372 Feb 4 0.0007235163 4.424760 0.0145160075 Mar 4 -0.0022237392 4.435693 0.0365309791 Apr 4 -0.0064565874 4.441651 0.0348056965 May 4 0.0072460626 4.447609 0.0151449157 Jun 4 0.0111127957 4.448951 0.0199365675 Jul 4 0.0057145993 4.450292 0.0139931487 Aug 4 -0.0071080199 4.446502 0.0406064055 Sep 4 -0.0085799742 4.442711 0.0258689972 Oct 4 -0.0019402674 4.434788 0.0071527377 Nov 4 0.0015610813 4.426864 0.0015748362 Dec 4 0.0003812681 4.418003 -0.0083843216 Jan 5 -0.0004307551 4.409142 0.0012887307 Feb 5 0.0007235163 4.399730 -0.0204536101 Mar 5 -0.0022237392 4.390318 -0.0380944240 Apr 5 -0.0064565874 4.381775 -0.0053180577 May 5 0.0072460626 4.373231 0.0195228105 Jun 5 0.0111127957 4.367272 0.0116153297 Jul 5 0.0057145993 4.361313 -0.0070272217 Aug 5 -0.0071080199 4.358372 -0.0112638228 Sep 5 -0.0085799742 4.355431 -0.0168510889 Oct 5 -0.0019402674 4.355000 -0.0230601826 Nov 5 0.0015610813 4.354570 -0.0161309183 Dec 5 0.0003812681 4.354716 -0.0150977096 Jan 6 -0.0004307551 4.354863 -0.0044322908 Feb 6 0.0007235163 4.354858 0.0144182795 Mar 6 -0.0022237392 4.354853 0.0373703766 Apr 6 -0.0064565874 4.353406 0.0530504523 May 6 0.0072460626 4.351959 0.0207950299 Jun 6 0.0111127957 4.349619 0.0092678399 Jul 6 0.0057145993 4.347280 0.0070055793 Aug 6 -0.0071080199 4.344694 -0.0075861446 Sep 6 -0.0085799742 4.342109 -0.0035285335 Oct 6 -0.0019402674 4.339088 -0.0071481276 Nov 6 0.0015610813 4.336068 -0.0176293638 Dec 6 0.0003812681 4.332720 -0.0031012422 Jan 7 -0.0004307551 4.329372 0.0110590895 > m$win s t l 731 19 13 > m$deg s t l 0 1 1 > m$jump s t l 74 2 2 > m$inner [1] 1 > m$outer [1] 15 > postscript(file="/var/www/html/rcomp/tmp/1w5z01243770339.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/250vy1243770339.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/34grd1243770339.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/4oub71243770339.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/568m91243770339.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/6n88b1243770339.tab") > > system("convert tmp/1w5z01243770339.ps tmp/1w5z01243770339.png") > system("convert tmp/250vy1243770339.ps tmp/250vy1243770339.png") > system("convert tmp/34grd1243770339.ps tmp/34grd1243770339.png") > system("convert tmp/4oub71243770339.ps tmp/4oub71243770339.png") > > > proc.time() user system elapsed 1.000 0.619 1.293