R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(579,572,560,551,537,541,588,607,599,578,563,566,561,554,540,526,512,505,554,584,569,540,522,526,527,516,503,489,479,475,524,552,532,511,492,492,493,481,462,457,442,439,488,521,501,485,464,460,467,460,448,443,436,431,484,510,513,503,471,471) > 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 4.570771 576.8750 -2.4457763 Feb 1 -2.379691 575.5660 -1.1863146 Mar 1 -14.530152 574.2570 0.2731469 Apr 1 -22.552379 572.9068 0.6455552 May 1 -33.174604 571.5566 -1.3820380 Jun 1 -34.888219 570.1745 5.7137124 Jul 1 15.798169 568.7924 3.4094612 Aug 1 44.240556 567.3696 -4.6101077 Sep 1 33.482931 565.9467 -0.4296644 Oct 1 15.501622 564.1010 -1.6026153 Nov 1 -4.079682 562.2553 4.8244283 Dec 1 -1.989320 559.8335 8.1558147 Jan 2 4.570771 557.4118 -0.9825281 Feb 2 -2.379691 554.7498 1.6298909 Mar 2 -14.530152 552.0878 2.4423097 Apr 2 -22.552379 549.0604 -0.5080205 May 2 -33.174604 546.0330 -0.8583524 Jun 2 -34.888219 542.8212 -2.9329532 Jul 2 15.798169 539.6094 -1.4075555 Aug 2 44.240556 536.5453 3.2141814 Sep 2 33.482931 533.4811 2.0359305 Oct 2 15.501622 530.5768 -6.0783988 Nov 2 -4.079682 527.6724 -1.5927336 Dec 2 -1.989320 524.9657 3.0235795 Jan 3 4.570771 522.2591 0.1701635 Feb 3 -2.379691 519.6273 -1.2476539 Mar 3 -14.530152 516.9956 0.5345284 Apr 3 -22.552379 514.3606 -2.8081751 May 3 -33.174604 511.7255 0.4491198 Jun 3 -34.888219 508.9988 0.8894279 Jul 3 15.798169 506.2721 1.9297345 Aug 3 44.240556 503.3522 4.4072624 Sep 3 33.482931 500.4323 -1.9151975 Oct 3 15.501622 497.3660 -1.8676677 Nov 3 -4.079682 494.2998 1.7798567 Dec 3 -1.989320 491.2621 2.7271750 Jan 4 4.570771 488.2245 0.2047642 Feb 4 -2.379691 485.4720 -2.0922875 Mar 4 -14.530152 482.7195 -6.1893395 Apr 4 -22.552379 480.2975 -0.7450986 May 4 -33.174604 477.8755 -2.7008593 Jun 4 -34.888219 475.7020 -1.8137889 Jul 4 15.798169 473.5286 -1.3267201 Aug 4 44.240556 471.8163 4.9431661 Sep 4 33.482931 470.1040 -2.5869354 Oct 4 15.501622 468.9593 0.5391268 Nov 4 -4.079682 467.8145 0.2651835 Dec 4 -1.989320 467.1227 -5.1334106 Jan 5 4.570771 466.4310 -4.0017339 Feb 5 -2.379691 466.4050 -4.0253335 Mar 5 -14.530152 466.3791 -3.8489333 Apr 5 -22.552379 467.5849 -2.0325355 May 5 -33.174604 468.7907 0.3838608 Jun 5 -34.888219 469.9261 -4.0378582 Jul 5 15.798169 471.0614 -2.8595788 Aug 5 44.240556 472.2626 -6.5031634 Sep 5 33.482931 473.4638 6.0532643 Oct 5 15.501622 474.7753 12.7231007 Nov 5 -4.079682 476.0868 -1.0070684 Dec 5 -1.989320 477.4632 -4.4738808 > m$win s t l 601 19 13 > m$deg s t l 0 1 1 > m$jump s t l 61 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1ahj81322492805.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/wessaorg/rcomp/tmp/287yv1322492805.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/wessaorg/rcomp/tmp/3i25p1322492805.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/wessaorg/rcomp/tmp/4yqbo1322492805.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/5derv1322492805.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/wessaorg/rcomp/tmp/68ezb1322492805.tab") > > try(system("convert tmp/1ahj81322492805.ps tmp/1ahj81322492805.png",intern=TRUE)) character(0) > try(system("convert tmp/287yv1322492805.ps tmp/287yv1322492805.png",intern=TRUE)) character(0) > try(system("convert tmp/3i25p1322492805.ps tmp/3i25p1322492805.png",intern=TRUE)) character(0) > try(system("convert tmp/4yqbo1322492805.ps tmp/4yqbo1322492805.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.272 0.201 1.479