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,8.1,7.7,7.5,7.6,7.8,7.8,7.8,7.5,7.5,7.1,7.5,7.5,7.6,7.7,7.7,7.9,8.1,8.2,8.2,8.2,7.9,7.3,6.9,6.6,6.7,6.9,7,7.1,7.2,7.1,6.9,7,6.8,6.4,6.7,6.6,6.4,6.3,6.2,6.5,6.8,6.8,6.4,6.1,5.8,6.1,7.2,7.3,6.9,6.1,5.8,6.2,7.1,7.7,7.9,7.7,7.4,7.5,8,8.1) > 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.03480090 7.937498 0.027700988 Feb 1 -0.03710175 7.887921 0.249181233 Mar 1 -0.22752060 7.838343 0.089177675 Apr 1 -0.32671867 7.794370 0.032348236 May 1 -0.10591691 7.750398 -0.044481028 Jun 1 0.22925798 7.711442 -0.140699494 Jul 1 0.34443291 7.672485 -0.216917984 Aug 1 0.26554377 7.636317 -0.101860654 Sep 1 0.12665489 7.600149 -0.226803585 Oct 1 -0.09112462 7.593436 -0.002311810 Nov 1 -0.28890415 7.586724 -0.197820022 Dec 1 0.07659654 7.620445 -0.197041160 Jan 2 0.03480090 7.654165 -0.188965961 Feb 2 -0.03710175 7.698371 -0.061269565 Mar 2 -0.22752060 7.742578 0.184943028 Apr 2 -0.32671867 7.774415 0.252303359 May 2 -0.10591691 7.806253 0.199663864 Jun 2 0.22925798 7.783727 0.087014814 Jul 2 0.34443291 7.761201 0.094365738 Aug 2 0.26554377 7.688079 0.246376907 Sep 2 0.12665489 7.614957 0.458387815 Oct 2 -0.09112462 7.529911 0.461213520 Nov 2 -0.28890415 7.444865 0.144039237 Dec 2 0.07659654 7.356588 -0.533185016 Jan 3 0.03480090 7.268312 -0.703112932 Feb 3 -0.03710175 7.175920 -0.438818134 Mar 3 -0.22752060 7.083528 0.043992862 Apr 3 -0.32671867 7.015081 0.311637536 May 3 -0.10591691 6.946635 0.259282384 Jun 3 0.22925798 6.911904 0.058837825 Jul 3 0.34443291 6.877174 -0.121606760 Aug 3 0.26554377 6.839766 -0.205310063 Sep 3 0.12665489 6.802359 0.070986373 Oct 3 -0.09112462 6.752900 0.138224419 Nov 3 -0.28890415 6.703442 -0.014537522 Dec 3 0.07659654 6.663285 -0.039882043 Jan 4 0.03480090 6.623129 -0.057930226 Feb 4 -0.03710175 6.577627 -0.140525074 Mar 4 -0.22752060 6.532124 -0.004603725 Apr 4 -0.32671867 6.486556 0.040162879 May 4 -0.10591691 6.440987 0.164929658 Jun 4 0.22925798 6.439935 0.130807500 Jul 4 0.34443291 6.438882 0.016685317 Aug 4 0.26554377 6.458816 -0.324359506 Sep 4 0.12665489 6.478750 -0.505404590 Oct 4 -0.09112462 6.485193 -0.594068423 Nov 4 -0.28890415 6.491636 -0.102732245 Dec 4 0.07659654 6.525513 0.597890870 Jan 5 0.03480090 6.559389 0.705810322 Feb 5 -0.03710175 6.650270 0.286831261 Mar 5 -0.22752060 6.741152 -0.413631604 Apr 5 -0.32671867 6.855934 -0.729215524 May 5 -0.10591691 6.970716 -0.664799270 Jun 5 0.22925798 7.090200 -0.219457809 Jul 5 0.34443291 7.209683 0.145883626 Aug 5 0.26554377 7.334279 0.300177499 Sep 5 0.12665489 7.458874 0.114471111 Oct 5 -0.09112462 7.590661 -0.099536597 Nov 5 -0.28890415 7.722448 0.066455708 Dec 5 0.07659654 7.859924 0.063479136 Jan 6 0.03480090 7.997400 0.067798901 > m$win s t l 611 19 13 > m$deg s t l 0 1 1 > m$jump s t l 62 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1k8uh1259940641.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/2l0lp1259940641.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/3d7uf1259940641.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/45p6m1259940641.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/5yw011259940641.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/64alk1259940641.tab") > system("convert tmp/1k8uh1259940641.ps tmp/1k8uh1259940641.png") > system("convert tmp/2l0lp1259940641.ps tmp/2l0lp1259940641.png") > system("convert tmp/3d7uf1259940641.ps tmp/3d7uf1259940641.png") > system("convert tmp/45p6m1259940641.ps tmp/45p6m1259940641.png") > > > proc.time() user system elapsed 0.952 0.611 1.128