R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(493,514,522,490,484,506,501,462,465,454,464,427,460,473,465,422,415,413,420,363,376,380,384,346,389,407,393,346,348,353,364,305,307,312,312,286,324,336,327,302,299,311,315,264,278,278,287,279,324,354,354,360,363,385,412,370,389,395,417,404) > 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 9.0016300 496.1801 -12.18176910 Feb 1 29.7643270 493.5555 -9.31985965 Mar 1 27.1270213 490.9309 3.94205241 Apr 1 0.3018469 488.0361 1.66209795 May 1 -0.5233132 485.1412 -0.61787088 Jun 1 12.1543793 482.0198 11.82578020 Jul 1 21.8320793 478.8985 0.26942384 Aug 1 -27.4751000 475.5985 13.87664926 Sep 1 -16.9822727 472.2984 9.68386801 Oct 1 -16.1842800 467.4576 2.72665737 Nov 1 -7.1862971 462.6168 8.56945654 Dec 1 -31.8300260 455.6533 3.17673452 Jan 2 9.0016300 448.6897 2.30862751 Feb 2 29.7643270 441.0530 2.18272011 Mar 2 27.1270213 433.4162 4.45681532 Apr 2 0.3018469 426.2193 -4.52117703 May 2 -0.5233132 419.0225 -3.49918376 Jun 2 12.1543793 412.6267 -11.78106316 Jul 2 21.8320793 406.2309 -8.06295002 Aug 2 -27.4751000 400.5230 -10.04787140 Sep 2 -16.9822727 394.8151 -1.83279946 Oct 2 -16.1842800 389.4391 6.74518400 Nov 2 -7.1862971 384.0631 7.12317726 Dec 2 -31.8300260 378.8802 -1.05013757 Jan 3 9.0016300 373.6972 6.30116261 Feb 3 29.7643270 368.2693 8.96641674 Mar 3 27.1270213 362.8413 3.03167349 Apr 3 0.3018469 357.0890 -11.39080131 May 3 -0.5233132 351.3366 -2.81329048 Jun 3 12.1543793 345.7323 -4.88669146 Jul 3 21.8320793 340.1280 2.03990010 Aug 3 -27.4751000 334.9766 -2.50152990 Sep 3 -16.9822727 329.8252 -5.84296658 Oct 3 -16.1842800 325.3934 2.79084337 Nov 3 -7.1862971 320.9616 -1.77533688 Dec 3 -31.8300260 317.1061 0.72389694 Jan 4 9.0016300 313.2506 1.74774577 Feb 4 29.7643270 309.9282 -3.69252083 Mar 4 27.1270213 306.6058 -6.73278482 Apr 4 0.3018469 304.1275 -2.42938103 May 4 -0.5233132 301.6493 -2.12599162 Jun 4 12.1543793 300.7116 -1.86599484 Jul 4 21.8320793 299.7739 -6.60600551 Aug 4 -27.4751000 301.0420 -9.56688519 Sep 4 -16.9822727 302.3100 -7.32777154 Oct 4 -16.1842800 306.2816 -12.09734599 Nov 4 -7.1862971 310.2532 -16.06691065 Dec 4 -31.8300260 316.9138 -6.08375754 Jan 5 9.0016300 323.5744 -8.57598941 Feb 5 29.7643270 332.4705 -8.23484804 Mar 5 27.1270213 341.3667 -14.49370406 Apr 5 0.3018469 351.8058 7.89232828 May 5 -0.5233132 362.2450 1.27834624 Jun 5 12.1543793 372.7795 0.06610756 Jul 5 21.8320793 383.3141 6.85386144 Aug 5 -27.4751000 393.9543 3.52077604 Sep 5 -16.9822727 404.5946 1.38768397 Oct 5 -16.1842800 415.2632 -4.07891143 Nov 5 -7.1862971 425.9318 -1.74549704 Dec 5 -31.8300260 436.5866 -0.75656181 > m$win s t l 601 19 13 > m$deg s t l 0 1 1 > m$jump s t l 61 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/1pg241293387876.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/2pg241293387876.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/3i71p1293387876.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/4i71p1293387876.ps",horizontal=F,onefile=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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/5wzzf1293387876.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/freestat/rcomp/tmp/6s8wo1293387876.tab") > > try(system("convert tmp/1pg241293387876.ps tmp/1pg241293387876.png",intern=TRUE)) character(0) > try(system("convert tmp/2pg241293387876.ps tmp/2pg241293387876.png",intern=TRUE)) character(0) > try(system("convert tmp/3i71p1293387876.ps tmp/3i71p1293387876.png",intern=TRUE)) character(0) > try(system("convert tmp/4i71p1293387876.ps tmp/4i71p1293387876.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.429 0.884 1.571