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(112,118,132,129,121,135,148,148,136,119,104,118,115,126,141,135,125,149,170,170,158,133,114,140,145,150,178,163,172,178,199,199,184,162,146,166,171,180,193,181,183,218,230,242,209,191,172,194,196,196,236,235,229,243,264,272,237,211,180,201,204,188,235,227,234,264,302,293,259,229,203,229,242,233,267,269,270,315,364,347,312,274,237,278,284,277,317,313,318,374,413,405,355,306,271,306,315,301,356,348,355,422,465,467,404,347,305,336,340,318,362,348,363,435,491,505,404,359,310,337,360,342,406,396,420,472,548,559,463,407,362,405,417,391,419,461,472,535,622,606,508,461,390,432) > 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 -25.497718 127.1873 10.31036990 Feb 1 -35.220935 126.6495 26.57140282 Mar 1 -3.027478 126.1117 8.91576248 Apr 1 -8.299054 126.1989 11.10012240 May 1 -5.737289 126.2861 0.45114078 Jun 1 32.336634 126.7330 -24.06965722 Jul 1 70.243882 127.1799 -49.42377968 Aug 1 68.049433 127.4162 -47.46564918 Sep 1 17.438326 127.6525 -9.09086079 Oct 1 -21.063432 129.0186 11.04484245 Nov 1 -57.481851 130.3846 31.09720711 Dec 1 -31.740516 132.3618 17.37867988 Jan 2 -25.497718 134.3390 6.15869051 Feb 2 -35.220935 135.1084 26.11257707 Mar 2 -3.027478 135.8777 8.14979039 Apr 2 -8.299054 135.9454 7.35364819 May 2 -5.737289 136.0131 -5.27583556 Jun 2 32.336634 137.2093 -20.54595443 Jul 2 70.243882 138.4055 -38.64939776 Aug 2 68.049433 141.3114 -39.36083873 Sep 2 17.438326 144.2173 -3.65562181 Oct 2 -21.063432 148.3371 5.72636661 Nov 2 -57.481851 152.4568 19.02501645 Dec 2 -31.740516 156.1257 15.61485924 Jan 3 -25.497718 159.7945 10.70323988 Feb 3 -35.220935 161.6914 23.52950035 Mar 3 -3.027478 163.5884 17.43908757 Apr 3 -8.299054 164.6017 6.69738099 May 3 -5.737289 165.6150 12.12233287 Jun 3 32.336634 167.2285 -21.56509136 Jul 3 70.243882 168.8420 -40.08584006 Aug 3 68.049433 171.2070 -40.25645599 Sep 3 17.438326 173.5721 -7.01041404 Oct 3 -21.063432 176.5526 6.51079382 Nov 3 -57.481851 179.5332 23.94866309 Dec 3 -31.740516 182.6278 15.11274939 Jan 4 -25.497718 185.7223 10.77537354 Feb 4 -35.220935 187.8163 27.40461728 Mar 4 -3.027478 189.9103 6.11718778 Apr 4 -8.299054 191.1312 -1.83211324 May 4 -5.737289 192.3520 -3.61475580 Jun 4 32.336634 194.0658 -8.40245074 Jul 4 70.243882 195.7796 -36.02347015 Aug 4 68.049433 198.7814 -24.83081992 Sep 4 17.438326 201.7832 -10.22151180 Oct 4 -21.063432 206.0687 5.99474323 Nov 4 -57.481851 210.3542 19.12765967 Dec 4 -31.740516 214.1849 11.55563782 Jan 5 -25.497718 218.0156 3.48215382 Feb 5 -35.220935 220.1263 11.09459538 Mar 5 -3.027478 222.2371 16.79036369 Apr 5 -8.299054 222.9376 20.36148810 May 5 -5.737289 223.6380 11.09927096 Jun 5 32.336634 223.7928 -13.12945404 Jul 5 70.243882 223.9476 -30.19150350 Aug 5 68.049433 223.9443 -19.99370772 Sep 5 17.438326 223.9409 -4.37925407 Oct 5 -21.063432 224.5947 7.46868162 Nov 5 -57.481851 225.2486 12.23327872 Dec 5 -31.740516 227.0215 5.71901399 Jan 6 -25.497718 228.7944 0.70328710 Feb 6 -35.220935 230.5535 -7.33257110 Mar 6 -3.027478 232.3126 5.71489744 Apr 6 -8.299054 233.8328 1.46622217 May 6 -5.737289 235.3531 4.38420535 Jun 6 32.336634 237.7041 -6.04073406 Jul 6 70.243882 240.0551 -8.29899793 Aug 6 68.049433 243.2465 -18.29598169 Sep 6 17.438326 246.4380 -4.87630758 Oct 6 -21.063432 250.1037 -0.04022517 Nov 6 -57.481851 253.7693 6.71251865 Dec 6 -31.740516 258.0836 2.65690861 Jan 7 -25.497718 262.3979 5.09983643 Feb 7 -35.220935 266.7545 1.46642081 Mar 7 -3.027478 271.1111 -1.08366806 Apr 7 -8.299054 274.8384 2.46064436 May 7 -5.737289 278.5657 -2.82838476 Jun 7 32.336634 282.0862 0.57720167 Jul 7 70.243882 285.6067 8.14946363 Aug 7 68.049433 289.3515 -10.40093208 Sep 7 17.438326 293.0963 1.46533009 Oct 7 -21.063432 297.0760 -2.01260749 Nov 7 -57.481851 301.0557 -6.57388365 Dec 7 -31.740516 305.4064 4.33415306 Jan 8 -25.497718 309.7570 -0.25927237 Feb 8 -35.220935 314.0295 -1.80854607 Mar 8 -3.027478 318.3020 1.72550697 Apr 8 -8.299054 321.7071 -0.40801520 May 8 -5.737289 325.1122 -1.37487891 Jun 8 32.336634 327.6514 14.01197715 Jul 8 70.243882 330.1906 12.56550875 Aug 8 68.049433 332.4831 4.46746283 Sep 8 17.438326 334.7756 2.78607479 Oct 8 -21.063432 337.3493 -10.28586362 Nov 8 -57.481851 339.9230 -11.44114062 Dec 8 -31.740516 343.5618 -5.82125409 Jan 9 -25.497718 347.2005 -6.70282970 Feb 9 -35.220935 351.9113 -15.69035040 Mar 9 -3.027478 356.6220 2.40545565 Apr 9 -8.299054 360.9900 -4.69097044 May 9 -5.737289 365.3580 -4.62073808 Jun 9 32.336634 368.2253 21.43804701 Jul 9 70.243882 371.0926 23.66350763 Aug 9 68.049433 372.2017 26.74885447 Sep 9 17.438326 373.3108 13.25085918 Oct 9 -21.063432 373.0689 -5.00549738 Nov 9 -57.481851 372.8270 -10.34519253 Dec 9 -31.740516 373.1663 -5.42583158 Jan 10 -25.497718 373.5057 -8.00793278 Feb 10 -35.220935 375.3037 -22.08276520 Mar 10 -3.027478 377.1017 -12.07427088 Apr 10 -8.299054 379.1766 -22.87753414 May 10 -5.737289 381.2514 -12.51413896 Jun 10 32.336634 382.8734 19.78995191 Jul 10 70.243882 384.4954 36.26071831 Aug 10 68.049433 386.4129 50.53766559 Sep 10 17.438326 388.3304 -1.76872925 Oct 10 -21.063432 390.6746 -10.61113352 Nov 10 -57.481851 393.0187 -25.53687639 Dec 10 -31.740516 396.3416 -27.60108633 Jan 11 -25.497718 399.6645 -14.16675842 Feb 11 -35.220935 404.9035 -27.68255170 Mar 11 -3.027478 410.1425 -1.11501823 Apr 11 -8.299054 416.3450 -12.04590874 May 11 -5.737289 422.5474 3.18985921 Jun 11 32.336634 427.7897 11.87371232 Jul 11 70.243882 433.0319 44.72424096 Aug 11 68.049433 436.4362 54.51433014 Sep 11 17.438326 439.8406 5.72107719 Oct 11 -21.063432 442.3755 -14.31206868 Nov 11 -57.481851 444.9104 -25.42855315 Dec 11 -31.740516 448.6402 -11.89966612 Jan 12 -25.497718 452.3700 -9.87224124 Feb 12 -35.220935 457.8121 -31.59119510 Mar 12 -3.027478 463.2543 -41.22682221 Apr 12 -8.299054 467.6104 1.68863111 May 12 -5.737289 471.9665 5.77074288 Jun 12 32.336634 475.6083 27.05506691 Jul 12 70.243882 479.2501 72.50606647 Aug 12 68.049433 483.1894 54.76116520 Sep 12 17.438326 487.1288 3.43292181 Oct 12 -21.063432 490.7530 -8.68958822 Nov 12 -57.481851 494.3773 -46.89543684 Dec 12 -31.740516 497.4299 -33.68938955 > m$win s t l 1441 19 13 > m$deg s t l 0 1 1 > m$jump s t l 145 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1yo7n1269527561.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/2yo7n1269527561.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/3rf7q1269527561.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/4rf7q1269527561.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/5n74h1269527561.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/6qpln1269527561.tab") > > try(system("convert tmp/1yo7n1269527561.ps tmp/1yo7n1269527561.png",intern=TRUE)) character(0) > try(system("convert tmp/2yo7n1269527561.ps tmp/2yo7n1269527561.png",intern=TRUE)) character(0) > try(system("convert tmp/3rf7q1269527561.ps tmp/3rf7q1269527561.png",intern=TRUE)) character(0) > try(system("convert tmp/4rf7q1269527561.ps tmp/4rf7q1269527561.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.431 0.646 1.760