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(376.974,377.632,378.205,370.861,369.167,371.551,382.842,381.903,384.502,392.058,384.359,388.884,386.586,387.495,385.705,378.67,377.367,376.911,389.827,387.82,387.267,380.575,372.402,376.74,377.795,376.126,370.804,367.98,367.866,366.121,379.421,378.519,372.423,355.072,344.693,342.892,344.178,337.606,327.103,323.953,316.532,306.307,327.225,329.573,313.761,307.836,300.074,304.198,306.122,300.414,292.133,290.616,280.244,285.179,305.486,305.957,293.886,289.441,288.776,299.149,306.532,309.914,313.468,314.901,309.16,316.15,336.544,339.196,326.738,320.838,318.62,331.533,335.378) > 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 2.4379925 373.3639 1.1720703 Feb 1 1.8257604 374.4114 1.3948314 Mar 1 -1.2137108 375.4589 3.9598316 Apr 1 -4.0016360 376.5453 -1.6827075 May 1 -7.8242280 377.6318 -0.6405799 Jun 1 -6.9850485 378.7079 -0.1718580 Jul 1 10.0613029 379.7840 -7.0033079 Aug 1 10.7613433 380.7715 -9.6298641 Sep 1 3.7923814 381.7590 -1.0494181 Oct 1 -1.2197900 382.6523 10.6254932 Nov 1 -6.9217907 383.5456 7.7352337 Dec 1 -0.7125794 384.1549 5.4417234 Jan 2 2.4379925 384.7642 -0.6161477 Feb 2 1.8257604 384.8197 0.8495778 Mar 2 -1.2137108 384.8752 2.0435422 Apr 2 -4.0016360 384.2660 -1.5943142 May 2 -7.8242280 383.6567 1.5344961 Jun 2 -6.9850485 382.7931 1.1029267 Jul 2 10.0613029 381.9295 -2.1638146 Aug 2 10.7613433 380.9948 -3.9361731 Sep 2 3.7923814 380.0601 3.4144707 Oct 2 -1.2197900 379.1049 2.6899148 Nov 2 -6.9217907 378.1496 1.1741882 Dec 2 -0.7125794 377.2404 0.2121607 Jan 3 2.4379925 376.3312 -0.9742274 Feb 3 1.8257604 375.2500 -0.9498090 Mar 3 -1.2137108 374.1689 -2.1511517 Apr 3 -4.0016360 372.4532 -0.4715496 May 3 -7.8242280 370.7375 4.9527193 Jun 3 -6.9850485 368.2626 4.8434443 Jul 3 10.0613029 365.7877 3.5719975 Aug 3 10.7613433 362.4971 5.2605735 Sep 3 3.7923814 359.2065 9.4241520 Oct 3 -1.2197900 355.1355 1.1562416 Nov 3 -6.9217907 351.0646 0.5501605 Dec 3 -0.7125794 346.4685 -2.8638810 Jan 4 2.4379925 341.8723 -0.1322833 Feb 4 1.8257604 337.3680 -1.5877682 Mar 4 -1.2137108 332.8637 -4.5470142 Apr 4 -4.0016360 328.8564 -0.9018042 May 4 -7.8242280 324.8492 -0.4929275 Jun 4 -6.9850485 321.4798 -8.1877801 Jul 4 10.0613029 318.1105 -0.9468047 Aug 4 10.7613433 315.1320 3.6796155 Sep 4 3.7923814 312.1536 -2.1849620 Oct 4 -1.2197900 309.4407 -0.3849264 Nov 4 -6.9217907 306.7279 0.2679385 Dec 4 -0.7125794 304.3990 0.5115810 Jan 5 2.4379925 302.0701 1.6138627 Feb 5 1.8257604 300.1715 -1.5832337 Mar 5 -1.2137108 298.2728 -4.9260912 Apr 5 -4.0016360 296.9223 -2.3047013 May 5 -7.8242280 295.5719 -7.5036446 Jun 5 -6.9850485 295.1252 -2.9611494 Jul 5 10.0613029 294.6785 0.7461740 Aug 5 10.7613433 295.5067 -0.3110198 Sep 5 3.7923814 296.3348 -6.2412111 Oct 5 -1.2197900 298.2852 -7.6243971 Nov 5 -6.9217907 300.2355 -4.5377538 Dec 5 -0.7125794 302.8722 -3.0105957 Jan 6 2.4379925 305.5088 -1.4147983 Feb 6 1.8257604 308.4119 -0.3236697 Mar 6 -1.2137108 311.3150 3.3666978 Apr 6 -4.0016360 313.8537 5.0489692 May 6 -7.8242280 316.3923 0.5919073 Jun 6 -6.9850485 318.6387 4.4963307 Jul 6 10.0613029 320.8851 5.5975823 Aug 6 10.7613433 323.1043 5.3303401 Sep 6 3.7923814 325.3235 -2.3778997 Oct 6 -1.2197900 327.4335 -5.3757201 Nov 6 -6.9217907 329.5435 -4.0017112 Dec 6 -0.7125794 331.5429 0.7026693 Jan 7 2.4379925 333.5423 -0.6023110 > m$win s t l 731 19 13 > m$deg s t l 0 1 1 > m$jump s t l 74 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1jzd71290972783.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/2jzd71290972783.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/3jzd71290972783.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/4u9us1290972783.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/5q1ai1290972783.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/6b19o1290972783.tab") > > try(system("convert tmp/1jzd71290972783.ps tmp/1jzd71290972783.png",intern=TRUE)) character(0) > try(system("convert tmp/2jzd71290972783.ps tmp/2jzd71290972783.png",intern=TRUE)) character(0) > try(system("convert tmp/3jzd71290972783.ps tmp/3jzd71290972783.png",intern=TRUE)) character(0) > try(system("convert tmp/4u9us1290972783.ps tmp/4u9us1290972783.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.996 0.637 2.647