R version 2.12.1 (2010-12-16) 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(547612,563280,581302,572273,518654,520579,530577,540324,547970,555654,551174,548604,563668,586111,604378,600991,544686,537034,551531,563250,574761,580112,575093,557560,564478,580523,596594,586570,536214,523597,536535,536322,532638,528222,516141,501866,506174,517945,533590,528379,477580,469357,490243,492622,507561,516922,514258,509846,527070,541657,564591,555362,498662,511038,525919,531673,548854,560576,557274,565742,587625,619916,625809,619567,572942,572775,574205,579799,590072,593408,597141,595404,612117,628232,628884,620735,569028,567456,573100,584428,589379,590865,595454,594167,611324,612613,610763,593530,542722,536662,543599,555332,560854,562325,554788,547344,565464,577992,579714,569323,506971,500857,509127,509933,517009,519164,512238,509239,518585,522975,525192,516847,455626,454724,461251,470439,474605,476049,471067,470984,502831,512927,509673,484015,431328,436087,442867,447988,460070,467037,460170,464196,485025) > 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 11766.677 539202.5 -3357.177061 Feb 1 25965.145 540867.2 -3552.319560 Mar 1 35310.440 542531.8 3459.710985 Apr 1 25573.997 544185.8 2513.215202 May 1 -27824.357 545839.7 638.629616 Jun 1 -29648.355 547521.6 2705.763659 Jul 1 -19378.262 549203.5 751.805880 Aug 1 -12300.119 550918.1 1706.036975 Sep 1 -3539.521 552632.7 -1123.187722 Oct 1 1323.327 554393.8 -63.121233 Nov 1 -2186.276 556154.9 -2794.603524 Dec 1 -5062.695 558112.7 -4445.993428 Jan 2 11766.677 560070.5 -8169.173554 Feb 2 25965.145 562114.5 -1968.662414 Mar 2 35310.440 564158.5 4909.021771 Apr 2 25573.997 566185.3 9231.653557 May 2 -27824.357 568212.2 4298.195540 Jun 2 -29648.355 569277.8 -2595.412901 Jul 2 -19378.262 570343.4 565.886836 Aug 2 -12300.119 570039.0 5511.124797 Sep 2 -3539.521 569734.6 8565.906966 Oct 2 1323.327 568664.2 10124.453822 Nov 2 -2186.276 567593.8 9685.451898 Dec 2 -5062.695 566143.1 -3520.393977 Jan 3 11766.677 564692.4 -11981.030074 Feb 3 25965.145 562293.8 -7735.967237 Mar 3 35310.440 559895.3 1388.268645 Apr 3 25573.997 556336.7 4659.348512 May 3 -27824.357 552778.0 11260.338577 Jun 3 -29648.355 548219.4 5025.911164 Jul 3 -19378.262 543660.9 12252.391929 Aug 3 -12300.119 538261.0 10361.103845 Sep 3 -3539.521 532861.2 3316.359969 Oct 3 1323.327 527273.4 -374.717413 Nov 3 -2186.276 521685.6 -3358.343575 Dec 3 -5062.695 516988.7 -10059.990864 Jan 4 11766.677 512291.8 -17884.428374 Feb 4 25965.145 509287.2 -17307.357726 Mar 4 35310.440 506282.7 -8003.114034 Apr 4 25573.997 505482.2 -2677.180539 May 4 -27824.357 504681.7 722.663152 Jun 4 -29648.355 505654.7 -6649.308068 Jul 4 -19378.262 506627.6 2993.628889 Aug 4 -12300.119 508537.3 -3615.200583 Sep 4 -3539.521 510447.0 653.514154 Oct 4 1323.327 512684.1 2914.546799 Nov 4 -2186.276 514921.2 1523.030665 Dec 4 -5062.695 517641.1 -2732.411513 Jan 5 11766.677 520361.0 -5057.643913 Feb 5 25965.145 523568.6 -7876.722479 Mar 5 35310.440 526776.2 2504.372000 Apr 5 25573.997 530538.5 -750.460894 May 5 -27824.357 534300.7 -7814.383592 Jun 5 -29648.355 538885.4 1800.905982 Jul 5 -19378.262 543470.2 1827.103733 Aug 5 -12300.119 548871.7 -4898.586490 Sep 5 -3539.521 554273.3 -1879.732505 Oct 5 1323.327 559931.7 -678.989114 Nov 5 -2186.276 565590.1 -6129.794504 Dec 5 -5062.695 570849.1 -44.439410 Jan 6 11766.677 576108.2 -249.874537 Feb 6 25965.145 580319.5 13631.371146 Mar 6 35310.440 584530.8 5967.789874 Apr 6 25573.997 587631.2 6361.791635 May 6 -27824.357 590731.7 10034.703593 Jun 6 -29648.355 592765.3 9658.038949 Jul 6 -19378.262 594799.0 -1215.717518 Aug 6 -12300.119 595691.2 -3592.046446 Sep 6 -3539.521 596583.4 -2971.831166 Oct 6 1323.327 596722.5 -4637.777034 Nov 6 -2186.276 596861.5 2465.728318 Dec 6 -5062.695 596812.2 3654.446241 Jan 7 11766.677 596762.9 3587.373944 Feb 7 25965.145 596744.5 5522.326979 Mar 7 35310.440 596726.1 -3152.546942 Apr 7 25573.997 596511.8 -1350.819487 May 7 -27824.357 596297.5 554.818164 Jun 7 -29648.355 595957.3 1147.083946 Jul 7 -19378.262 595617.0 -3138.742094 Aug 7 -12300.119 594801.2 1926.954772 Sep 7 -3539.521 593985.3 -1066.804155 Oct 7 1323.327 592282.7 -2741.014245 Nov 7 -2186.276 590580.0 7060.226885 Dec 7 -5062.695 588135.5 11094.148687 Jan 8 11766.677 585691.0 13866.280269 Feb 8 25965.145 582946.8 3701.048886 Mar 8 35310.440 580202.6 -4750.009453 Apr 8 25573.997 577084.6 -9128.621317 May 8 -27824.357 573966.7 -3420.322983 Jun 8 -29648.355 570650.9 -4340.581595 Jul 8 -19378.262 567335.2 -4357.932030 Aug 8 -12300.119 564478.1 3154.010767 Sep 8 -3539.521 561621.0 2772.497773 Oct 8 1323.327 559096.5 1905.209577 Nov 8 -2186.276 556571.9 402.372601 Dec 8 -5062.695 553627.2 -1220.550626 Jan 9 11766.677 550682.6 3014.735927 Feb 9 25965.145 547232.7 4794.203924 Mar 9 35310.440 543782.7 620.844966 Apr 9 25573.997 540126.9 3622.131550 May 9 -27824.357 536471.0 -1675.671668 Jun 9 -29648.355 532715.1 -2209.753494 Jul 9 -19378.262 528959.2 -453.927142 Aug 9 -12300.119 524855.4 -2622.299352 Sep 9 -3539.521 520751.6 -203.127354 Oct 9 1323.327 516503.1 1337.527984 Nov 9 -2186.276 512254.6 2169.634543 Dec 9 -5062.695 508175.8 6125.849561 Jan 10 11766.677 504097.0 2721.274359 Feb 10 25965.145 500288.0 -3278.131425 Mar 10 35310.440 496478.9 -6597.364164 Apr 10 25573.997 492960.1 -1687.126739 May 10 -27824.357 489441.3 -5990.979118 Jun 10 -29648.355 486857.2 -2484.811769 Jul 10 -19378.262 484273.0 -3643.736243 Aug 10 -12300.119 482733.0 6.081365 Sep 10 -3539.521 481193.1 -3048.556818 Oct 10 1323.327 479700.9 -4975.228099 Nov 10 -2186.276 478208.7 -4955.448160 Dec 10 -5062.695 476499.6 -452.914909 Jan 11 11766.677 474790.5 16273.828122 Feb 11 25965.145 473207.1 13754.763381 Mar 11 35310.440 471623.7 2738.871685 Apr 11 25573.997 470390.3 -11949.344330 May 11 -27824.357 469157.0 -10004.650149 Jun 11 -29648.355 468355.1 -2619.707409 Jul 11 -19378.262 467553.1 -5307.856492 Aug 11 -12300.119 466787.7 -6499.557726 Sep 11 -3539.521 466022.2 -2412.714753 Oct 11 1323.327 465363.2 350.454836 Nov 11 -2186.276 464704.2 -2347.924355 Dec 11 -5062.695 464213.7 5044.947474 Jan 12 11766.677 463723.3 9535.029083 > m$win s t l 1331 19 13 > m$deg s t l 0 1 1 > m$jump s t l 134 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/1jr541322677405.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/2ia7k1322677405.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/3eyjd1322677405.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/4yt7w1322677405.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/5kmet1322677405.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/6j8li1322677405.tab") > > try(system("convert tmp/1jr541322677405.ps tmp/1jr541322677405.png",intern=TRUE)) character(0) > try(system("convert tmp/2ia7k1322677405.ps tmp/2ia7k1322677405.png",intern=TRUE)) character(0) > try(system("convert tmp/3eyjd1322677405.ps tmp/3eyjd1322677405.png",intern=TRUE)) character(0) > try(system("convert tmp/4yt7w1322677405.ps tmp/4yt7w1322677405.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.196 0.348 2.525