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(6.9,6.8,6.7,6.6,6.5,6.5,7.0,7.5,7.6,7.6,7.6,7.8,8.0,8.0,8.0,7.9,7.9,8.0,8.5,9.2,9.4,9.5,9.5,9.6,9.7,9.7,9.6,9.5,9.4,9.3,9.6,10.2,10.2,10.1,9.9,9.8,9.8,9.7,9.5,9.3,9.1,9.0,9.5,10.0,10.2,10.1,10.0,9.9,10.0,9.9,9.7,9.5,9.2,9.0,9.3,9.8,9.8,9.6,9.4,9.3,9.2,9.2,9.0,8.8,8.7,8.7,9.1,9.7,9.8,9.6,9.4,9.4,9.5,9.4,9.3,9.2,9.0,8.9,9.2,9.8,9.9,9.6,9.2,9.1,9.1,9.0,8.9,8.7,8.5,8.3,8.5,8.7,8.4,8.1,7.8,7.7,7.5,7.2,6.8,6.7,6.4,6.3,6.8,7.3,7.1,7.0,6.8,6.6,6.3,6.1,6.1,6.3,6.3,6.0,6.2,6.4,6.8,7.5,7.5,7.6,7.6,7.4,7.3,7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.0,8.2,8.1,8.1,8.0,7.9,7.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 0.17452940 6.610912 0.114558649 Feb 1 0.07727596 6.698910 0.023814344 Mar 1 -0.09331078 6.786907 0.006403331 Apr 1 -0.27261692 6.877332 -0.004715201 May 1 -0.45192315 6.967757 -0.015833658 Jun 1 -0.55067417 7.060438 -0.009764114 Jul 1 -0.06275857 7.153120 -0.090361187 Aug 1 0.30580116 7.247583 -0.053384369 Sep 1 0.35436081 7.342047 -0.096407475 Oct 1 0.27001822 7.448747 -0.118764718 Nov 1 0.11900888 7.555446 -0.074455212 Dec 1 0.13028913 7.680470 -0.010759440 Jan 2 0.17452940 7.805494 0.019976311 Feb 2 0.07727596 7.945646 -0.022921640 Mar 2 -0.09331078 8.085797 0.007513701 Apr 2 -0.27261692 8.237275 -0.064658229 May 2 -0.45192315 8.388753 -0.036830082 Jun 2 -0.55067417 8.540559 0.010114683 Jul 2 -0.06275857 8.692366 -0.129607170 Aug 2 0.30580116 8.836367 0.057832128 Sep 2 0.35436081 8.980368 0.065271501 Oct 2 0.27001822 9.112040 0.117941874 Nov 2 0.11900888 9.243712 0.137278997 Dec 2 0.13028913 9.352432 0.117278770 Jan 3 0.17452940 9.461152 0.064318523 Feb 3 0.07727596 9.540391 0.082333317 Mar 3 -0.09331078 9.619629 0.073681404 Apr 3 -0.27261692 9.668494 0.104123030 May 3 -0.45192315 9.717358 0.134564733 Jun 3 -0.55067417 9.738759 0.111915504 Jul 3 -0.06275857 9.760159 -0.097400342 Aug 3 0.30580116 9.758693 0.135505904 Sep 3 0.35436081 9.757227 0.088412226 Oct 3 0.27001822 9.740310 0.089672220 Nov 3 0.11900888 9.723392 0.057598964 Dec 3 0.13028913 9.701520 -0.031808858 Jan 4 0.17452940 9.679647 -0.054176700 Feb 4 0.07727596 9.665584 -0.042859958 Mar 4 -0.09331078 9.651521 -0.058209924 Apr 4 -0.27261692 9.651994 -0.079376660 May 4 -0.45192315 9.652466 -0.100543320 Jun 4 -0.55067417 9.666459 -0.115784526 Jul 4 -0.06275857 9.680451 -0.117692349 Aug 4 0.30580116 9.700410 -0.006211384 Sep 4 0.35436081 9.720370 0.125269657 Oct 4 0.27001822 9.736514 0.093467427 Nov 4 0.11900888 9.752659 0.128331947 Dec 4 0.13028913 9.751320 0.018390678 Jan 5 0.17452940 9.749981 0.075489388 Feb 5 0.07727596 9.726025 0.096698657 Mar 5 -0.09331078 9.702070 0.091241217 Apr 5 -0.27261692 9.659767 0.112850238 May 5 -0.45192315 9.617464 0.034459336 Jun 5 -0.55067417 9.562427 -0.011752349 Jul 5 -0.06275857 9.507389 -0.144630653 Aug 5 0.30580116 9.446860 0.047338625 Sep 5 0.35436081 9.386331 0.059307977 Oct 5 0.27001822 9.334465 -0.004483302 Nov 5 0.11900888 9.282599 -0.001607832 Dec 5 0.13028913 9.250178 -0.080467499 Jan 6 0.17452940 9.217758 -0.192287185 Feb 6 0.07727596 9.206504 -0.083779557 Mar 6 -0.09331078 9.195249 -0.101938636 Apr 6 -0.27261692 9.199893 -0.127276163 May 6 -0.45192315 9.204537 -0.052613613 Jun 6 -0.55067417 9.220518 0.030156468 Jul 6 -0.06275857 9.236499 -0.073740068 Aug 6 0.30580116 9.258367 0.135832017 Sep 6 0.35436081 9.280235 0.165404178 Oct 6 0.27001822 9.303124 0.026857550 Nov 6 0.11900888 9.326013 -0.045022327 Dec 6 0.13028913 9.341771 -0.072060241 Jan 7 0.17452940 9.357529 -0.032058175 Feb 7 0.07727596 9.367035 -0.044310803 Mar 7 -0.09331078 9.376541 0.016769861 Apr 7 -0.27261692 9.376384 0.096233103 May 7 -0.45192315 9.376227 0.075696422 Jun 7 -0.55067417 9.357829 0.092845278 Jul 7 -0.06275857 9.339431 -0.076672483 Aug 7 0.30580116 9.302775 0.191423756 Sep 7 0.35436081 9.266119 0.279520070 Oct 7 0.27001822 9.220925 0.109056892 Nov 7 0.11900888 9.175731 -0.094739537 Dec 7 0.13028913 9.118456 -0.148744912 Jan 8 0.17452940 9.061181 -0.135710308 Feb 8 0.07727596 8.978366 -0.055641479 Mar 8 -0.09331078 8.895550 0.097760642 Apr 8 -0.27261692 8.786865 0.185752384 May 8 -0.45192315 8.678179 0.273744203 Jun 8 -0.55067417 8.549208 0.301466380 Jul 8 -0.06275857 8.420237 0.142521938 Aug 8 0.30580116 8.262158 0.132040945 Sep 8 0.35436081 8.104079 -0.058439973 Oct 8 0.27001822 7.928735 -0.098752905 Nov 8 0.11900888 7.753390 -0.072399087 Dec 8 0.13028913 7.592354 -0.022642779 Jan 9 0.17452940 7.431317 -0.105846491 Feb 9 0.07727596 7.306500 -0.183775926 Mar 9 -0.09331078 7.181683 -0.288372068 Apr 9 -0.27261692 7.088150 -0.115532806 May 9 -0.45192315 6.994617 -0.142693467 Jun 9 -0.55067417 6.912971 -0.062296539 Jul 9 -0.06275857 6.831325 0.031433770 Aug 9 0.30580116 6.757886 0.236312469 Sep 9 0.35436081 6.684448 0.061191243 Oct 9 0.27001822 6.632830 0.097151469 Nov 9 0.11900888 6.581213 0.099778444 Dec 9 0.13028913 6.540586 -0.070875462 Jan 10 0.17452940 6.499960 -0.374489389 Feb 10 0.07727596 6.467737 -0.445013226 Mar 10 -0.09331078 6.435515 -0.242203772 Apr 10 -0.27261692 6.453902 0.118715157 May 10 -0.45192315 6.472289 0.279634162 Jun 10 -0.55067417 6.551958 -0.001284047 Jul 10 -0.06275857 6.631627 -0.368868875 Aug 10 0.30580116 6.732936 -0.638736918 Sep 10 0.35436081 6.834244 -0.388604885 Oct 10 0.27001822 6.924137 0.305844536 Nov 10 0.11900888 7.014030 0.366960707 Dec 10 0.13028913 7.100815 0.368896048 Jan 11 0.17452940 7.187599 0.237871369 Feb 11 0.07727596 7.263144 0.059579810 Mar 11 -0.09331078 7.338689 0.054621542 Apr 11 -0.27261692 7.388948 -0.016330609 May 11 -0.45192315 7.439206 -0.087282684 Jun 11 -0.55067417 7.489029 -0.138354355 Jul 11 -0.06275857 7.538851 0.023907356 Aug 11 0.30580116 7.604446 -0.310247600 Sep 11 0.35436081 7.670042 -0.224402480 Oct 11 0.27001822 7.740385 -0.010403557 Nov 11 0.11900888 7.810729 0.170262116 Dec 11 0.13028913 7.880431 0.189279592 Jan 12 0.17452940 7.950134 0.175337049 Feb 12 0.07727596 8.006268 0.116456380 Mar 12 -0.09331078 8.062402 0.030909003 Apr 12 -0.27261692 8.097343 0.075273794 May 12 -0.45192315 8.132284 -0.080361338 Jun 12 -0.55067417 8.162943 -0.012269122 Jul 12 -0.06275857 8.193602 0.169156476 Aug 12 0.30580116 8.226096 -0.131896725 Sep 12 0.35436081 8.258589 -0.212949851 Oct 12 0.27001822 8.264885 -0.134902847 Nov 12 0.11900888 8.271180 0.009810906 Dec 12 0.13028913 8.274702 0.195008759 Jan 13 0.17452940 8.278224 0.447246592 Feb 13 0.07727596 8.310485 0.412239286 Mar 13 -0.09331078 8.342746 0.050565272 Apr 13 -0.27261692 8.367500 -0.594883573 May 13 -0.45192315 8.392255 -0.740332341 Jun 13 -0.55067417 8.386577 -0.435902620 Jul 13 -0.06275857 8.380898 0.481860484 Aug 13 0.30580116 8.386816 0.607382811 Sep 13 0.35436081 8.392734 0.552905214 Oct 13 0.27001822 8.423953 0.006029112 Nov 13 0.11900888 8.455171 -0.374180240 Dec 13 0.13028913 8.468332 -0.298621084 Jan 14 0.17452940 8.481493 -0.156021947 Feb 14 0.07727596 8.465549 0.057175464 Mar 14 -0.09331078 8.449605 0.143706167 Apr 14 -0.27261692 8.442077 0.030539457 May 14 -0.45192315 8.434550 0.117372825 Jun 14 -0.55067417 8.438388 0.012285713 Jul 14 -0.06275857 8.442227 0.220531983 Aug 14 0.30580116 8.447843 -0.053644521 Sep 14 0.35436081 8.453460 -0.107820950 Oct 14 0.27001822 8.465956 -0.235973801 Nov 14 0.11900888 8.478451 -0.197459903 Dec 14 0.13028913 8.483537 -0.113826492 Jan 15 0.17452940 8.488624 0.036846898 Feb 15 0.07727596 8.466544 0.156179745 Mar 15 -0.09331078 8.444465 0.248845885 Apr 15 -0.27261692 8.371778 0.400838955 May 15 -0.45192315 8.299091 0.452832102 Jun 15 -0.55067417 8.228890 0.321784070 Jul 15 -0.06275857 8.158689 0.104069421 Aug 15 0.30580116 8.081688 -0.287489457 Sep 15 0.35436081 8.004687 -0.259048260 Oct 15 0.27001822 7.918986 -0.189004344 Nov 15 0.11900888 7.833285 -0.052293677 Dec 15 0.13028913 7.742407 0.027303542 > m$win s t l 1801 19 13 > m$deg s t l 0 1 1 > m$jump s t l 181 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1xjq81259934391.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/230kw1259934391.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/3flyb1259934391.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/4ug601259934391.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/5h0y51259934391.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/6uaco1259934391.tab") > system("convert tmp/1xjq81259934391.ps tmp/1xjq81259934391.png") > system("convert tmp/230kw1259934391.ps tmp/230kw1259934391.png") > system("convert tmp/3flyb1259934391.ps tmp/3flyb1259934391.png") > system("convert tmp/4ug601259934391.ps tmp/4ug601259934391.png") > > > proc.time() user system elapsed 1.764 0.664 6.103