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(92.9,107.7,103.5,91.1,79.8,71.9,82.9,90.1,100.7,90.7,108.8,44.1,93.6,107.4,96.5,93.6,76.5,76.7,84,103.3,88.5,99,105.9,44.7,94,107.1,104.8,102.5,77.7,85.2,91.3,106.5,92.4,97.5,107,51.1,98.6,102.2,114.3,99.4,72.5,92.3,99.4,85.9,109.4,97.6,104.7,56.9,86.7,108.5,103.4,86.2,71,75.9,87.1,102,88.5,87.8,100.8,50.6,85.9) > 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 1.963743 89.74723 1.18903050 Feb 1 15.822626 89.55265 2.32472647 Mar 1 13.767902 89.35807 0.37403028 Apr 1 3.867572 89.20545 -1.97302321 May 1 -15.152768 89.05283 5.89993294 Jun 1 -10.202873 88.91823 -6.81536070 Jul 1 -1.612985 88.78363 -4.27064702 Aug 1 7.100055 88.62343 -5.62348931 Sep 1 5.533095 88.46324 6.70366911 Oct 1 4.258424 88.43683 -1.99525743 Nov 1 15.283746 88.41043 5.10582344 Dec 1 -40.628534 88.56178 -3.83324841 Jan 2 1.963743 88.71313 2.92312299 Feb 2 15.822626 88.85118 2.72619010 Mar 2 13.767902 88.98923 -6.25713494 Apr 2 3.867572 89.01365 0.71877831 May 2 -15.152768 89.03807 2.61470118 Jun 2 -10.202873 89.11053 -2.20765367 Jul 2 -1.612985 89.18299 -3.57000120 Aug 2 7.100055 89.40494 6.79500834 Sep 2 5.533095 89.62689 -6.65998141 Oct 2 4.258424 90.07019 4.67138294 Nov 2 15.283746 90.51350 0.10275469 Dec 2 -40.628534 91.02499 -5.69645475 Jan 3 1.963743 91.53648 0.49977907 Feb 3 15.822626 91.95859 -0.68122086 Mar 3 13.767902 92.38071 -1.34861295 Apr 3 3.867572 92.64493 5.98749354 May 3 -15.152768 92.90916 -0.05639035 Jun 3 -10.202873 93.08051 2.32236732 Jul 3 -1.612985 93.25185 -0.33886769 Aug 3 7.100055 93.32484 6.07510615 Sep 3 5.533095 93.39782 -6.53091930 Oct 3 4.258424 93.39220 -0.15062609 Nov 3 15.283746 93.38658 -1.67032548 Dec 3 -40.628534 93.47752 -1.74898924 Jan 4 1.963743 93.56847 3.06779027 Feb 4 15.822626 93.71037 -7.33299449 Mar 4 13.767902 93.85227 6.67982860 Apr 4 3.867572 94.01165 1.52077725 May 4 -15.152768 94.17103 -6.51826447 Jun 4 -10.202873 94.11724 8.38563537 Jul 4 -1.612985 94.06344 6.94954254 Aug 4 7.100055 93.70477 -14.90482951 Sep 4 5.533095 93.34611 10.52079916 Oct 4 4.258424 92.63864 0.70293478 Nov 4 15.283746 91.93118 -2.51492220 Dec 4 -40.628534 91.19895 6.32958066 Jan 5 1.963743 90.46673 -5.73047322 Feb 5 15.822626 89.86324 2.81413531 Mar 5 13.767902 89.25975 0.37235169 Apr 5 3.867572 88.76746 -6.43503351 May 5 -15.152768 88.27518 -2.12240909 Jun 5 -10.202873 87.90475 -1.80187714 Jul 5 -1.612985 87.53432 1.17866212 Aug 5 7.100055 87.20488 7.69506451 Sep 5 5.533095 86.87544 -3.90853240 Oct 5 4.258424 86.57776 -3.03618348 Nov 5 15.283746 86.28008 -0.76382716 Dec 5 -40.628534 86.00706 5.22147897 Jan 6 1.963743 85.73403 -1.79777164 > 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/1j1as1259948291.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/2egzb1259948291.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/3zupp1259948291.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/4wept1259948291.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/50kdj1259948291.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/62le31259948291.tab") > > system("convert tmp/1j1as1259948291.ps tmp/1j1as1259948291.png") > system("convert tmp/2egzb1259948291.ps tmp/2egzb1259948291.png") > system("convert tmp/3zupp1259948291.ps tmp/3zupp1259948291.png") > system("convert tmp/4wept1259948291.ps tmp/4wept1259948291.png") > > > proc.time() user system elapsed 0.972 0.619 2.179