R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(183.046,175.714,175.768,171.029,170.465,170.102,156.389,124.291,99.360,86.675,85.056,128.236,164.257,162.401,152.779,156.005,153.387,153.190,148.840,144.211,145.953,145.542,150.271,147.489,143.824,134.754,131.736,126.304,125.511,125.495,130.133,126.257,110.323,98.417,105.749,120.665,124.075,127.245,146.731,144.979,148.210,144.670,142.970,142.524,146.142,146.522,148.128,148.798,150.181,152.388,155.694,160.662,155.520,158.262,154.338,158.196,160.371,154.856,150.636,145.899,141.242,140.834,141.119,139.104,134.437,129.425,123.155,119.273,120.472,121.523,121.983,123.658,124.794,124.827,120.382,117.395,115.790,114.283,117.271,117.448,118.764,120.550,123.554,125.412,124.182,119.828,115.361,114.226,115.214,115.864,114.276,113.469,114.883,114.172,111.225,112.149,115.618,118.002,121.382,120.663,128.049) > 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 4.9740391 176.7330 1.33895995 Feb 1 4.0241104 171.3791 0.31077123 Mar 1 5.3169609 166.0252 4.42580328 Apr 1 4.5643238 161.0871 5.37753515 May 1 4.5673490 156.1490 9.74860472 Jun 1 3.4139027 151.8027 14.88535345 Jul 1 0.9052478 147.4564 8.02731086 Aug 1 -3.6317032 143.5979 -15.67524496 Sep 1 -6.6309067 139.7395 -33.74854832 Oct 1 -9.4536530 137.3094 -41.18079378 Nov 1 -7.7318993 134.8794 -42.09153925 Dec 1 -0.3177680 135.1662 -6.61239856 Jan 2 4.9740391 135.4529 23.83006636 Feb 2 4.0241104 138.0336 20.34329915 Mar 2 5.3169609 140.6143 6.84775270 Apr 2 4.5643238 144.0521 7.38859176 May 2 4.5673490 147.4899 1.32976853 Jun 2 3.4139027 148.8173 0.95876273 Jul 2 0.9052478 150.1448 -2.21003438 Aug 2 -3.6317032 148.9644 -1.12171501 Sep 2 -6.6309067 147.7840 4.79985683 Oct 2 -9.4536530 145.6573 9.33830651 Nov 2 -7.7318993 143.5306 14.47225617 Dec 2 -0.3177680 141.1267 6.68007262 Jan 3 4.9740391 138.7227 0.12721330 Feb 3 4.0241104 136.0463 -5.31644557 Mar 3 5.3169609 133.3699 -6.95088367 Apr 3 4.5643238 130.3508 -8.61113500 May 3 4.5673490 127.3317 -6.38804863 Jun 3 3.4139027 125.0510 -2.96985620 Jul 3 0.9052478 122.7702 6.45754492 Aug 3 -3.6317032 122.2674 7.62133329 Sep 3 -6.6309067 121.7645 -4.81062586 Oct 3 -9.4536530 122.7573 -14.88665001 Nov 3 -7.7318993 123.7501 -10.26917417 Dec 3 -0.3177680 125.4483 -4.46551620 Jan 4 4.9740391 127.1465 -8.04553400 Feb 4 4.0241104 129.5718 -6.35094432 Mar 4 5.3169609 131.9972 9.41686612 Apr 4 4.5643238 135.2154 5.19928577 May 4 4.5673490 138.4336 5.20904312 Jun 4 3.4139027 141.1967 0.05937584 Jul 4 0.9052478 143.9598 -1.89508275 Aug 4 -3.6317032 145.6704 0.48529238 Sep 4 -6.6309067 147.3810 5.39191998 Oct 4 -9.4536530 148.4081 7.56757104 Nov 4 -7.7318993 149.4352 6.42472209 Dec 4 -0.3177680 150.2975 -1.18177221 Jan 5 4.9740391 151.1599 -5.95294228 Feb 5 4.0241104 152.0337 -3.66976300 Mar 5 5.3169609 152.9074 -2.53036294 Apr 5 4.5643238 153.6879 2.40978190 May 5 4.5673490 154.4684 -3.51573556 Jun 5 3.4139027 154.6550 0.19313638 Jul 5 0.9052478 154.8415 -1.40878299 Aug 5 -3.6317032 154.0364 7.79129402 Sep 5 -6.6309067 153.2313 13.77062350 Oct 5 -9.4536530 151.4490 12.86061534 Nov 5 -7.7318993 149.6668 8.70110717 Dec 5 -0.3177680 147.0033 -0.78651596 Jan 6 4.9740391 144.3398 -8.07181486 Feb 6 4.0241104 141.1284 -4.31855221 Mar 6 5.3169609 137.9171 -2.11506880 Apr 6 4.5643238 135.1736 -0.63390971 May 6 4.5673490 132.4301 -2.56041291 Jun 6 3.4139027 130.6330 -4.62186827 Jul 6 0.9052478 128.8359 -6.58611494 Aug 6 -3.6317032 127.4385 -4.53378145 Sep 6 -6.6309067 126.0411 1.06180450 Oct 6 -9.4536530 124.6251 6.35158508 Nov 6 -7.7318993 123.2090 6.50586566 Dec 6 -0.3177680 122.0252 1.95052382 Jan 7 4.9740391 120.8415 -1.02149378 Feb 7 4.0241104 120.1114 0.69148215 Mar 7 5.3169609 119.3814 -4.31632117 Apr 7 4.5643238 119.2228 -6.39213284 May 7 4.5673490 119.0643 -7.84160680 Jun 7 3.4139027 119.3288 -8.45970420 Jul 7 0.9052478 119.5933 -3.22759291 Aug 7 -3.6317032 119.8069 1.27275458 Sep 7 -6.6309067 120.0206 5.37435455 Oct 7 -9.4536530 119.9348 10.06887148 Nov 7 -7.7318993 119.8490 11.43688840 Dec 7 -0.3177680 119.4197 6.31010168 Jan 8 4.9740391 118.9903 0.21763919 Feb 8 4.0241104 118.2799 -2.47603655 Mar 8 5.3169609 117.5695 -7.52549154 Apr 8 4.5643238 116.8717 -7.21001935 May 8 4.5673490 116.1739 -5.52720945 Jun 8 3.4139027 115.7336 -3.28346178 Jul 8 0.9052478 115.2933 -1.92250540 Aug 8 -3.6317032 115.3113 1.78941502 Sep 8 -6.6309067 115.3293 6.18458792 Oct 8 -9.4536530 115.6896 7.93602139 Nov 8 -7.7318993 116.0499 2.90695485 Dec 8 -0.3177680 116.4356 -3.96882241 Jan 9 4.9740391 116.8212 -6.17727544 Feb 9 4.0241104 117.1390 -3.16106272 Mar 9 5.3169609 117.4567 -1.39162925 Apr 9 4.5643238 117.7322 -1.63352418 May 9 4.5673490 118.0077 5.47391860 > m$win s t l 1011 19 13 > m$deg s t l 0 1 1 > m$jump s t l 102 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/18fup1324139432.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/rcomp/tmp/2zye51324139432.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/rcomp/tmp/3xijp1324139432.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/rcomp/tmp/4x1fr1324139432.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/5qj001324139432.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/rcomp/tmp/6sf2y1324139432.tab") > > try(system("convert tmp/18fup1324139432.ps tmp/18fup1324139432.png",intern=TRUE)) character(0) > try(system("convert tmp/2zye51324139432.ps tmp/2zye51324139432.png",intern=TRUE)) character(0) > try(system("convert tmp/3xijp1324139432.ps tmp/3xijp1324139432.png",intern=TRUE)) character(0) > try(system("convert tmp/4x1fr1324139432.ps tmp/4x1fr1324139432.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.450 0.120 1.573