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(3.42,3.42,3.43,3.47,3.51,3.52,3.52,3.52,3.52,3.52,3.52,3.52,3.52,3.52,3.58,3.6,3.61,3.61,3.61,3.63,3.68,3.69,3.69,3.69,3.69,3.69,3.69,3.69,3.69,3.78,3.79,3.79,3.8,3.8,3.8,3.8,3.81,3.95,3.99,4,4.06,4.16,4.19,4.2,4.2,4.2,4.2,4.2,4.23,4.38,4.43,4.44,4.44,4.44,4.44,4.44,4.45,4.45,4.45,4.45,4.45,4.45,4.45,4.45,4.46,4.46,4.46,4.48,4.58,4.67,4.68,4.68) > 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.026437103 3.443667 0.002770361 Feb 1 -0.023614209 3.452247 -0.008632757 Mar 1 -0.017048770 3.460827 -0.013778420 Apr 1 -0.019982837 3.469490 0.020492355 May 1 0.006205068 3.478154 0.025641158 Jun 1 0.041309477 3.487021 -0.008330513 Jul 1 0.031711049 3.495888 -0.007599347 Aug 1 0.018577597 3.504913 -0.003490754 Sep 1 0.009130068 3.513938 -0.003068084 Oct 1 0.007058847 3.523282 -0.010340607 Nov 1 -0.006696195 3.532626 -0.005929308 Dec 1 -0.020212979 3.542225 -0.002012358 Jan 2 -0.026437103 3.551825 -0.005388069 Feb 2 -0.023614209 3.562351 -0.018737153 Mar 2 -0.017048770 3.572878 0.024171217 Apr 2 -0.019982837 3.585704 0.034278557 May 2 0.006205068 3.598531 0.005263925 Jun 2 0.041309477 3.612452 -0.043761041 Jul 2 0.031711049 3.626372 -0.048083170 Aug 2 0.018577597 3.639019 -0.027596659 Sep 2 0.009130068 3.651666 0.019203930 Oct 2 0.007058847 3.662830 0.020110717 Nov 2 -0.006696195 3.673995 0.022701326 Dec 2 -0.020212979 3.685263 0.024949540 Jan 3 -0.026437103 3.696532 0.019905094 Feb 3 -0.023614209 3.707144 0.006469969 Mar 3 -0.017048770 3.717756 -0.010707701 Apr 3 -0.019982837 3.727046 -0.017063514 May 3 0.006205068 3.736336 -0.052541299 Jun 3 0.041309477 3.747905 -0.009214334 Jul 3 0.031711049 3.759473 -0.001184533 Aug 3 0.018577597 3.780484 -0.009061147 Sep 3 0.009130068 3.801494 -0.010623684 Oct 3 0.007058847 3.829346 -0.036405318 Nov 3 -0.006696195 3.857199 -0.050503130 Dec 3 -0.020212979 3.888806 -0.068593196 Jan 4 -0.026437103 3.920413 -0.083975923 Feb 4 -0.023614209 3.953979 0.019634781 Mar 4 -0.017048770 3.987546 0.019502940 Apr 4 -0.019982837 4.022021 -0.002038196 May 4 0.006205068 4.056496 -0.002701303 Jun 4 0.041309477 4.087594 0.031096457 Jul 4 0.031711049 4.118692 0.039597053 Aug 4 0.018577597 4.145070 0.036352828 Sep 4 0.009130068 4.171447 0.019422681 Oct 4 0.007058847 4.195867 -0.002926321 Nov 4 -0.006696195 4.220288 -0.013591502 Dec 4 -0.020212979 4.244457 -0.024244514 Jan 5 -0.026437103 4.268627 -0.012190186 Feb 5 -0.023614209 4.290221 0.113393683 Mar 5 -0.017048770 4.311814 0.135235006 Apr 5 -0.019982837 4.332981 0.127001941 May 5 0.006205068 4.354148 0.079646903 Jun 5 0.041309477 4.377010 0.021680204 Jul 5 0.031711049 4.399873 0.008416341 Aug 5 0.018577597 4.416815 0.004607251 Sep 5 0.009130068 4.433758 0.007112238 Oct 5 0.007058847 4.441803 0.001138585 Nov 5 -0.006696195 4.449847 0.006848754 Dec 5 -0.020212979 4.456668 0.013544848 Jan 6 -0.026437103 4.463489 0.012948281 Feb 6 -0.023614209 4.475720 -0.002105922 Mar 6 -0.017048770 4.487951 -0.020902670 Apr 6 -0.019982837 4.513543 -0.043560658 May 6 0.006205068 4.539136 -0.085340619 Jun 6 0.041309477 4.559778 -0.141087047 Jul 6 0.031711049 4.580420 -0.152130638 Aug 6 0.018577597 4.600861 -0.139438541 Sep 6 0.009130068 4.621302 -0.050432365 Oct 6 0.007058847 4.642260 0.020681087 Nov 6 -0.006696195 4.663218 0.023478361 Dec 6 -0.020212979 4.684692 0.015521291 > m$win s t l 721 19 13 > m$deg s t l 0 1 1 > m$jump s t l 73 2 2 > m$inner [1] 1 > m$outer [1] 15 > postscript(file="/var/www/html/rcomp/tmp/1pj9a1243879353.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/2ye0o1243879353.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/3sdz61243879353.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/46ant1243879353.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/5c41a1243879353.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/64c1r1243879354.tab") > > system("convert tmp/1pj9a1243879353.ps tmp/1pj9a1243879353.png") > system("convert tmp/2ye0o1243879353.ps tmp/2ye0o1243879353.png") > system("convert tmp/3sdz61243879353.ps tmp/3sdz61243879353.png") > system("convert tmp/46ant1243879353.ps tmp/46ant1243879353.png") > > > proc.time() user system elapsed 0.970 0.597 1.245