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(8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8,8.2,8.1,8.1,8,7.9,7.9,8,8,7.9,8,7.7,7.2,7.5,7.3,7,7,7,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8,8,7.7,7.3,7.4,8.1,8.3,8.2) > 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.20399943 8.377759 -0.181758174 Feb 1 -0.02650082 8.370189 0.056311849 Mar 1 -0.18830864 8.362619 0.225689440 Apr 1 -0.03683143 8.361718 0.275112994 May 1 0.24797900 8.360818 0.291203327 Jun 1 0.26854913 8.367408 0.164043244 Jul 1 0.08911938 8.373998 -0.163116960 Aug 1 -0.20339006 8.379910 -0.676519961 Sep 1 -0.46256635 8.385822 -0.723256109 Oct 1 -0.50645582 8.382071 -0.475615180 Nov 1 0.24965460 8.378320 0.172025855 Dec 1 0.36475180 8.391694 0.543554179 Jan 2 0.20399943 8.405068 0.690932073 Feb 2 -0.02650082 8.437677 0.288824262 Mar 2 -0.18830864 8.470285 -0.081975982 Apr 2 -0.03683143 8.478818 -0.141986176 May 2 0.24797900 8.487351 -0.235329592 Jun 2 0.26854913 8.462635 -0.131184235 Jul 2 0.08911938 8.437920 -0.027039000 Aug 2 -0.20339006 8.426759 -0.023368825 Sep 2 -0.46256635 8.415598 0.146968203 Oct 2 -0.50645582 8.427623 -0.021167274 Nov 2 0.24965460 8.439648 -0.089302644 Dec 2 0.36475180 8.452721 -0.117473157 Jan 3 0.20399943 8.465795 0.030205899 Feb 3 -0.02650082 8.479679 0.046821337 Mar 3 -0.18830864 8.493564 0.094744341 Apr 3 -0.03683143 8.494023 0.042808406 May 3 0.24797900 8.494482 -0.042460751 Jun 3 0.26854913 8.463631 -0.032179951 Jul 3 0.08911938 8.432780 0.078100727 Aug 3 -0.20339006 8.382412 0.320977934 Sep 3 -0.46256635 8.332044 0.430521996 Oct 3 -0.50645582 8.274794 0.231661381 Nov 3 0.24965460 8.217545 -0.267199128 Dec 3 0.36475180 8.154499 -0.419250457 Jan 4 0.20399943 8.091453 -0.195452216 Feb 4 -0.02650082 8.037780 -0.011278924 Mar 4 -0.18830864 7.984107 0.104201934 Apr 4 -0.03683143 7.938441 -0.001609908 May 4 0.24797900 7.892776 -0.140754973 Jun 4 0.26854913 7.830686 -0.099235075 Jul 4 0.08911938 7.768596 0.042284701 Aug 4 -0.20339006 7.687129 0.516260698 Sep 4 -0.46256635 7.605663 0.556903549 Oct 4 -0.50645582 7.525567 0.180889223 Nov 4 0.24965460 7.445470 -0.195124996 Dec 4 0.36475180 7.355956 -0.420708052 Jan 5 0.20399943 7.266442 -0.470441538 Feb 5 -0.02650082 7.167190 -0.140688832 Mar 5 -0.18830864 7.067937 0.120371441 Apr 5 -0.03683143 7.016634 0.220197385 May 5 0.24797900 6.965331 0.086690106 Jun 5 0.26854913 6.973509 -0.142057667 Jul 5 0.08911938 6.981686 -0.270805562 Aug 5 -0.20339006 6.991201 -0.387811017 Sep 5 -0.46256635 7.000716 -0.438149619 Oct 5 -0.50645582 7.013303 -0.006847452 Nov 5 0.24965460 7.025891 0.424454821 Dec 5 0.36475180 7.084231 0.451017500 Jan 6 0.20399943 7.142571 0.153429749 Feb 6 -0.02650082 7.227866 -0.301364818 Mar 6 -0.18830864 7.313160 -0.524851819 Apr 6 -0.03683143 7.388754 -0.451922726 May 6 0.24797900 7.464348 -0.012326855 Jun 6 0.26854913 7.537033 0.194417580 Jul 6 0.08911938 7.609719 0.301161894 Aug 6 -0.20339006 7.687151 0.216239162 Sep 6 -0.46256635 7.764583 -0.002016715 Oct 6 -0.50645582 7.844400 0.062055796 Nov 6 0.24965460 7.924217 -0.073871588 Dec 6 0.36475180 8.003746 -0.068497911 Jan 7 0.20399943 8.083275 -0.087274666 > 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] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/18wbn1259697099.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/2swfo1259697099.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/358ti1259697099.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/4w8j81259697099.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/5qepq1259697099.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/6m5lf1259697099.tab") > system("convert tmp/18wbn1259697099.ps tmp/18wbn1259697099.png") > system("convert tmp/2swfo1259697099.ps tmp/2swfo1259697099.png") > system("convert tmp/358ti1259697099.ps tmp/358ti1259697099.png") > system("convert tmp/4w8j81259697099.ps tmp/4w8j81259697099.png") > > > proc.time() user system elapsed 1.017 0.609 1.191