R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(37,30,47,35,30,43,82,40,47,19,52,136,80,42,54,66,81,63,137,72,107,58,36,52,79,77,54,84,48,96,83,66,61,53,30,74,69,59,42,65,70,100,63,105,82,81,75,102,121,98,76,77,63,37,35,23,40,29,37,51,20,28,13,22,25,13,16,13,16,17,9,17,25,14,8,7,10,7,10,3) > 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 10.8239302 30.694969 -4.5188990 Feb 1 -1.0331025 33.734513 -2.7014100 Mar 1 -8.7472919 36.774056 18.9732356 Apr 1 0.2110631 39.847967 -5.0590302 May 1 -3.8306037 42.921878 -9.0912743 Jun 1 1.1688093 45.985154 -4.1539636 Jul 1 11.1681906 49.048431 21.7833787 Aug 1 -3.1936594 52.011785 -8.8181258 Sep 1 3.1259183 54.975140 -11.1010579 Oct 1 -12.4241262 57.518434 -26.0943074 Nov 1 -14.9741820 60.061727 6.9124545 Dec 1 17.7050474 63.114080 55.1808722 Jan 2 10.8239302 66.166433 3.0096364 Feb 2 -1.0331025 69.546497 -26.5133948 Mar 2 -8.7472919 72.926561 -10.1792693 Apr 2 0.2110631 74.507243 -8.7183061 May 2 -3.8306037 76.087925 8.7426790 Jun 2 1.1688093 75.357093 -13.5259020 Jul 2 11.1681906 74.626261 51.2055488 Aug 2 -3.1936594 74.254298 0.9393615 Sep 2 3.1259183 73.882335 29.9917466 Oct 2 -12.4241262 73.404550 -2.9804242 Nov 2 -14.9741820 72.926766 -21.9525837 Dec 2 17.7050474 71.737880 -37.4429274 Jan 3 10.8239302 70.548995 -2.3729247 Feb 3 -1.0331025 69.345125 8.6879771 Mar 3 -8.7472919 68.141256 -5.3939645 Apr 3 0.2110631 67.690909 16.0980281 May 3 -3.8306037 67.240561 -15.4099575 Jun 3 1.1688093 66.911309 27.9198813 Jul 3 11.1681906 66.582058 5.2497519 Aug 3 -3.1936594 65.441845 3.7518148 Sep 3 3.1259183 64.301632 -6.4275499 Oct 3 -12.4241262 63.433689 1.9904374 Nov 3 -14.9741820 62.565746 -17.5915641 Dec 3 17.7050474 62.734377 -6.4394242 Jan 4 10.8239302 62.903008 -4.7269379 Feb 4 -1.0331025 64.557004 -4.5239019 Mar 4 -8.7472919 66.211001 -15.4637094 Apr 4 0.2110631 69.068905 -4.2799682 May 4 -3.8306037 71.926809 1.9037949 Jun 4 1.1688093 75.381589 23.4496013 Jul 4 11.1681906 78.836370 -27.0045605 Aug 4 -3.1936594 81.860051 26.3336079 Sep 4 3.1259183 84.883733 -6.0096513 Oct 4 -12.4241262 85.859830 7.5642966 Nov 4 -14.9741820 86.835926 3.1382559 Dec 4 17.7050474 84.423827 -0.1288742 Jan 5 10.8239302 82.011728 28.1643421 Feb 5 -1.0331025 77.399248 21.6338543 Mar 5 -8.7472919 72.786769 11.9605231 Apr 5 0.2110631 67.578630 9.2103070 May 5 -3.8306037 62.370491 4.4601126 Jun 5 1.1688093 56.720668 -20.8894778 Jul 5 11.1681906 51.070846 -27.2390364 Aug 5 -3.1936594 45.500845 -19.3071852 Sep 5 3.1259183 39.930843 -3.0567616 Oct 5 -12.4241262 36.119094 5.3050317 Nov 5 -14.9741820 32.307346 19.6668363 Dec 5 17.7050474 30.092010 3.2029423 Jan 6 10.8239302 27.876675 -18.7006052 Feb 6 -1.0331025 26.044585 2.9885180 Mar 6 -8.7472919 24.212494 -2.4652023 Apr 6 0.2110631 22.412639 -0.6237019 May 6 -3.8306037 20.612783 8.2178203 Jun 6 1.1688093 19.272517 -7.4413267 Jul 6 11.1681906 17.932251 -13.1004420 Aug 6 -3.1936594 17.081217 -0.8875575 Sep 6 3.1259183 16.230182 -3.3561007 Oct 6 -12.4241262 15.465593 13.9585327 Nov 6 -14.9741820 14.701005 9.2731774 Dec 6 17.7050474 13.728748 -14.4337950 Jan 7 10.8239302 12.756491 1.4195791 Feb 7 -1.0331025 11.708589 3.3245135 Mar 7 -8.7472919 10.660687 6.0866045 Apr 7 0.2110631 9.583485 -2.7945477 May 7 -3.8306037 8.506282 5.3243220 Jun 7 1.1688093 7.373991 -1.5428002 Jul 7 11.1681906 6.241700 -7.4098905 Aug 7 -3.1936594 5.056570 1.1370897 > m$win s t l 801 19 13 > m$deg s t l 0 1 1 > m$jump s t l 81 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/1qds41291912196.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/html/freestat/rcomp/tmp/20nsp1291912196.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/html/freestat/rcomp/tmp/30nsp1291912196.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/html/freestat/rcomp/tmp/4bw9s1291912196.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/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/50yre1291912197.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/freestat/rcomp/tmp/63g821291912197.tab") > > try(system("convert tmp/1qds41291912196.ps tmp/1qds41291912196.png",intern=TRUE)) character(0) > try(system("convert tmp/20nsp1291912196.ps tmp/20nsp1291912196.png",intern=TRUE)) character(0) > try(system("convert tmp/30nsp1291912196.ps tmp/30nsp1291912196.png",intern=TRUE)) character(0) > try(system("convert tmp/4bw9s1291912196.ps tmp/4bw9s1291912196.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.571 0.910 1.796