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(21790,13253,37702,30364,32609,30212,29965,28352,25814,22414,20506,28806,22228,13971,36845,35338,35022,34777,26887,23970,22780,17351,21382,24561,17409,11514,31514,27071,29462,26105,22397,23843,21705,18089,20764,25316,17704,15548,28029,29383,36438,32034,22679,24319,18004,17537,20366,22782,19169,13807,29743,25591,29096,26482,22405,27044,17970,18730,19684,19785,18479,10698,31956,29506,34506,27165,26736,23691,18157,17328,18205,20995,17382,9367,31124,26551,30651,25859,25100,25778,20418,18688,20424,24776,19814,12738,31566,30111,30019,31934,25826,26835,20205,17789,20520,22518,15572,11509,25447,24090,27786,26195,20516,22759,19028,16971,20036,22485,18730) > 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 -4969.104425 26269.65 489.45142 Feb 1 -11364.748378 26364.19 -1746.44079 Mar 1 7738.466697 26458.73 3504.80797 Apr 1 4879.487155 26554.50 -1069.98764 May 1 7965.508202 26650.28 -2006.78383 Jun 1 5219.757950 26740.98 -1748.73594 Jul 1 982.231510 26831.68 2151.08813 Aug 1 1469.023974 26925.16 -42.18361 Sep 1 -3220.852600 27018.64 2016.21369 Oct 1 -5311.681678 27168.50 557.18224 Nov 1 -3383.178393 27318.36 -3429.18157 Dec 1 -4.909644 27415.45 1395.45614 Jan 2 -4969.104425 27512.55 -315.44262 Feb 2 -11364.748378 27371.18 -2035.43457 Mar 2 7738.466697 27229.82 1876.71445 Apr 2 4879.487155 26984.90 3473.61080 May 2 7965.508202 26739.99 316.50657 Jun 2 5219.757950 26428.02 3129.21873 Jul 2 982.231510 26116.06 -211.29291 Aug 2 1469.023974 25682.18 -3181.20494 Sep 2 -3220.852600 25248.30 752.55207 Oct 2 -5311.681678 24729.14 -2066.46129 Nov 2 -3383.178393 24209.99 555.19299 Dec 2 -4.909644 23768.21 797.70086 Jan 3 -4969.104425 23326.43 -948.32775 Feb 3 -11364.748378 23100.86 -222.10960 Mar 3 7738.466697 22875.28 900.24951 Apr 3 4879.487155 22823.52 -632.00443 May 3 7965.508202 22771.75 -1275.25896 Jun 3 5219.757950 22832.97 -1947.72850 Jul 3 982.231510 22894.19 -1479.42185 Aug 3 1469.023974 23018.97 -644.99313 Sep 3 -3220.852600 23143.75 1782.10463 Oct 3 -5311.681678 23386.19 14.49079 Nov 3 -3383.178393 23628.63 518.54459 Dec 3 -4.909644 23893.78 1427.12778 Jan 4 -4969.104425 24158.93 -1485.82550 Feb 4 -11364.748378 24207.42 2705.32421 Mar 4 7738.466697 24255.92 -3965.38510 Apr 4 4879.487155 24139.45 364.06339 May 4 7965.508202 24022.98 4449.51129 Jun 4 5219.757950 23929.17 2885.06996 Jul 4 982.231510 23835.36 -2138.59518 Aug 4 1469.023974 23734.77 -884.79080 Sep 4 -3220.852600 23634.17 -2409.31738 Oct 4 -5311.681678 23403.78 -555.10154 Nov 4 -3383.178393 23173.40 575.78195 Dec 4 -4.909644 22936.57 -149.66129 Jan 5 -4969.104425 22699.75 1438.35901 Feb 5 -11364.748378 22659.73 2512.02153 Mar 5 7738.466697 22619.71 -615.17499 Apr 5 4879.487155 22597.79 -1886.28035 May 5 7965.508202 22575.88 -1445.38630 Jun 5 5219.757950 22486.59 -1224.34701 Jul 5 982.231510 22397.30 -974.53152 Aug 5 1469.023974 22399.30 3175.67891 Sep 5 -3220.852600 22401.29 -1210.44162 Oct 5 -5311.681678 22597.40 1444.28048 Nov 5 -3383.178393 22793.51 273.67021 Dec 5 -4.909644 22995.97 -3206.05602 Jan 6 -4969.104425 23198.42 249.68128 Feb 6 -11364.748378 23257.63 -1194.88371 Mar 6 7738.466697 23316.84 900.69227 Apr 6 4879.487155 23293.93 1332.58051 May 6 7965.508202 23271.02 3269.46817 Jun 6 5219.757950 23194.35 -1249.11112 Jul 6 982.231510 23117.68 2636.08577 Aug 6 1469.023974 22956.60 -734.62330 Sep 6 -3220.852600 22795.52 -1417.66333 Oct 6 -5311.681678 22582.07 57.60750 Nov 6 -3383.178393 22368.63 -780.45403 Dec 6 -4.909644 22244.62 -1244.70800 Jan 7 -4969.104425 22120.60 230.50155 Feb 7 -11364.748378 22179.98 -1448.23123 Mar 7 7738.466697 22239.36 1146.17696 Apr 7 4879.487155 22429.42 -757.90695 May 7 7965.508202 22619.48 66.00854 Jun 7 5219.757950 22856.08 -2216.84111 Jul 7 982.231510 23092.68 1025.08543 Aug 7 1469.023974 23317.31 991.67072 Sep 7 -3220.852600 23541.93 96.92504 Oct 7 -5311.681678 23724.63 275.05481 Nov 7 -3383.178393 23907.33 -100.14778 Dec 7 -4.909644 24067.25 713.65475 Jan 8 -4969.104425 24227.18 555.92080 Feb 8 -11364.748378 24306.09 -203.34001 Mar 8 7738.466697 24384.99 -557.45984 Apr 8 4879.487155 24366.01 865.50218 May 8 7965.508202 24347.03 -2293.53640 Jun 8 5219.757950 24203.49 2510.74838 Jul 8 982.231510 24059.96 783.80934 Aug 8 1469.023974 23772.50 1593.47163 Sep 8 -3220.852600 23485.05 -59.19705 Oct 8 -5311.681678 23070.89 29.79264 Nov 8 -3383.178393 22656.73 1246.44996 Dec 8 -4.909644 22213.48 309.43222 Jan 9 -4969.104425 21770.23 -1229.12198 Feb 9 -11364.748378 21446.56 1427.18946 Mar 9 7738.466697 21122.89 -3414.35813 Apr 9 4879.487155 21111.49 -1900.97284 May 9 7965.508202 21100.08 -1279.58815 Jun 9 5219.757950 21264.51 -289.27157 Jul 9 982.231510 21428.95 -1895.17880 Aug 9 1469.023974 21620.10 -330.12081 Sep 9 -3220.852600 21811.25 437.60621 Oct 9 -5311.681678 22042.91 239.76770 Nov 9 -3383.178393 22274.58 1144.59683 Dec 9 -4.909644 22544.81 -54.89670 Jan 10 -4969.104425 22815.03 884.07331 > m$win s t l 1091 19 13 > m$deg s t l 0 1 1 > m$jump s t l 110 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1bisu1260549846.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/2km3f1260549846.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/336o81260549846.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/45sqe1260549846.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/5n8kh1260549846.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/6lams1260549846.tab") > system("convert tmp/1bisu1260549846.ps tmp/1bisu1260549846.png") > system("convert tmp/2km3f1260549846.ps tmp/2km3f1260549846.png") > system("convert tmp/336o81260549846.ps tmp/336o81260549846.png") > system("convert tmp/45sqe1260549846.ps tmp/45sqe1260549846.png") > > > proc.time() user system elapsed 1.198 0.652 1.886