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(376.974,377.632,378.205,370.861,369.167,371.551,382.842,381.903,384.502,392.058,384.359,388.884,386.586,387.495,385.705,378.67,377.367,376.911,389.827,387.82,387.267,380.575,372.402,376.74,377.795,376.126,370.804,367.98,367.866,366.121,379.421,378.519,372.423,355.072,344.693,342.892,344.178,337.606,327.103,323.953,316.532,306.307,327.225,329.573,313.761,307.836,300.074,304.198,306.122,300.414,292.133,290.616,280.244,285.179,305.486,305.957,293.886,289.441,288.776,299.149,306.532,309.914,313.468,314.901,309.16,316.15,336.544,339.196,326.738,320.838,318.62,331.533,335.378) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = '6' > 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.3966622 375.6985 -0.12115882 Feb 1 1.1899868 376.4215 0.02050500 Mar 1 -1.4812374 377.1445 2.54171771 Apr 1 -6.1141304 377.8675 -0.89240086 May 1 -7.3178852 378.5399 -2.05505858 Jun 1 -7.3444209 379.2124 -0.31693538 Jul 1 7.6812035 379.8848 -4.72397233 Aug 1 8.2522458 380.4718 -6.82101534 Sep 1 6.0213974 381.0588 -2.57816761 Oct 1 2.4329477 381.6458 7.97928137 Nov 1 -4.5504790 382.2071 6.70233054 Dec 1 -0.1944248 382.7685 6.30989891 Jan 2 1.5394267 383.3299 1.71666994 Feb 2 1.1672692 383.3412 2.98656854 Mar 2 -1.8395492 383.3524 4.19212804 Apr 2 -5.9524944 383.3637 1.25881431 May 2 -7.3072902 382.8277 1.84659645 Jun 2 -7.5307117 382.2917 2.15000435 Jul 2 8.1712597 381.7557 -0.09998060 Aug 2 9.0574076 380.8766 -2.11400401 Sep 2 6.0413101 379.9975 1.22821802 Oct 2 1.9565575 379.1183 -0.49990497 Nov 2 -4.8147438 378.0511 -0.83431534 Dec 2 -0.3208139 376.9838 0.07704299 Jan 3 1.8310970 375.9165 0.04742041 Feb 3 1.0909800 374.2685 0.76650693 Mar 3 -2.8158581 372.6205 0.99931466 Apr 3 -5.5706329 370.9726 2.57805901 May 3 -7.2157725 368.5130 6.56880996 Jun 3 -7.8813247 366.0534 7.94897345 Jul 3 9.6150714 363.5937 6.21218873 Aug 3 11.2932036 360.3170 6.90880485 Sep 3 6.2959665 357.0402 9.08679031 Oct 3 0.2993681 353.7635 1.00913696 Nov 3 -5.8496986 349.8769 0.66582409 Dec 3 -0.9462016 345.9903 -2.15205248 Jan 4 2.4560460 342.1036 -0.38167960 Feb 4 0.8633235 338.1119 -1.36918953 Mar 4 -3.7071643 334.1201 -3.30993419 Apr 4 -4.5394986 330.1283 -1.63583231 May 4 -8.3566797 326.5162 -1.62750139 Jun 4 -8.1278087 322.9040 -8.46922253 Jul 4 11.5203940 319.2919 -3.58727536 Aug 4 13.5496105 316.2250 -0.20156653 Sep 4 4.4511196 313.1580 -3.84815039 Oct 4 -2.7126592 310.0911 0.45755369 Nov 4 -7.7907628 307.7114 0.15338397 Dec 4 -1.6755226 305.3317 0.54187045 Jan 5 2.7118701 302.9519 0.45820450 Feb 5 1.3911736 301.4742 -2.45134185 Mar 5 -2.5272278 299.9964 -5.33618328 Apr 5 -3.1558597 298.5187 -4.74679411 May 5 -8.3925766 298.1692 -9.53263044 Jun 5 -7.3032829 297.8198 -5.33747731 Jul 5 12.4889597 297.4703 -4.47327309 Aug 5 14.2018962 298.4141 -6.65896811 Sep 5 3.3247612 299.3578 -8.79659166 Oct 5 -3.6855610 300.3016 -7.17502799 Nov 5 -8.4448716 302.2497 -5.02882076 Dec 5 -1.2805946 304.1978 -3.76820124 Jan 6 2.8161156 306.1459 -2.43001477 Feb 6 1.5129596 308.5311 -0.13006088 Mar 6 -2.2737152 310.9163 4.82541174 Apr 6 -2.7904107 313.3015 4.38990507 May 6 -8.6208032 315.7248 2.05596773 Jun 6 -7.1800635 318.1482 5.18189808 Jul 6 12.7480617 320.5715 3.22444299 Aug 6 14.3247097 323.0020 1.86926700 Sep 6 2.7679463 325.4326 -1.46249769 Oct 6 -4.0833235 327.8631 -2.94175595 Nov 6 -8.6799987 330.2508 -2.95077213 Dec 6 -1.1270478 332.6385 0.02158571 Jan 7 2.8908130 335.0262 -2.53896649 > m$win s t l 6 25 13 > m$deg s t l 0 1 1 > m$jump s t l 1 3 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1i2601290973088.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/2i2601290973088.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/3btn31290973088.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/4btn31290973088.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/5hc2x1290973088.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/63v021290973088.tab") > > try(system("convert tmp/1i2601290973088.ps tmp/1i2601290973088.png",intern=TRUE)) character(0) > try(system("convert tmp/2i2601290973088.ps tmp/2i2601290973088.png",intern=TRUE)) character(0) > try(system("convert tmp/3btn31290973088.ps tmp/3btn31290973088.png",intern=TRUE)) character(0) > try(system("convert tmp/4btn31290973088.ps tmp/4btn31290973088.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.015 0.658 2.831