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(4143,4429,5219,4929,5761,5592,4163,4962,5208,4755,4491,5732,5731,5040,6102,4904,5369,5578,4619,4731,5011,5299,4146,4625,4736,4219,5116,4205,4121,5103,4300,4578,3809,5657,4248,3830,4736,4839,4411,4570,4104,4801,3953,3828,4440,4026,4109,4785,3224,3552,3940,3913,3681,4309,3830,4143,4087,3818,3380,3430,3458,3970,5260,5024,5634,6549,4676) > 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 -220.568010 4635.093 -271.52484 Feb 1 -231.193654 4694.491 -34.29740 Mar 1 421.180632 4753.889 43.93010 Apr 1 -10.856409 4814.478 125.37852 May 1 161.772721 4875.067 724.16077 Jun 1 688.523091 4938.562 -35.08507 Jul 1 -393.559569 5002.057 -445.49788 Aug 1 -71.387748 5063.479 -30.09107 Sep 1 -6.607645 5124.900 89.70747 Oct 1 184.644741 5160.461 -590.10619 Nov 1 -460.303579 5196.023 -244.71915 Dec 1 -61.644453 5206.639 587.00551 Jan 2 -220.568010 5217.255 734.31284 Feb 2 -231.193654 5218.747 52.44665 Mar 2 421.180632 5220.239 460.58052 Apr 2 -10.856409 5193.704 -278.84733 May 2 161.772721 5167.169 40.05865 Jun 2 688.523091 5106.944 -217.46745 Jul 2 -393.559569 5046.720 -34.16052 Aug 2 -71.387748 4975.499 -173.11078 Sep 2 -6.607645 4904.277 113.33068 Oct 2 184.644741 4837.139 277.21618 Nov 2 -460.303579 4770.001 -163.69762 Dec 2 -61.644453 4712.364 -25.71923 Jan 3 -220.568010 4654.726 301.84184 Feb 3 -231.193654 4610.163 -159.96917 Mar 3 421.180632 4565.599 129.21990 Apr 3 -10.856409 4541.355 -325.49880 May 3 161.772721 4517.111 -557.88367 Jun 3 688.523091 4510.380 -95.90281 Jul 3 -393.559569 4503.648 189.91108 Aug 3 -71.387748 4511.077 138.31040 Sep 3 -6.607645 4518.506 -702.89857 Oct 3 184.644741 4522.145 950.21037 Nov 3 -460.303579 4525.784 182.52001 Dec 3 -61.644453 4507.376 -615.73135 Jan 4 -220.568010 4488.968 467.59996 Feb 4 -231.193654 4450.236 619.95791 Mar 4 421.180632 4411.503 -421.68408 Apr 4 -10.856409 4374.124 206.73247 May 4 161.772721 4336.744 -394.51715 Jun 4 688.523091 4299.133 -186.65622 Jul 4 -393.559569 4261.522 85.03775 Aug 4 -71.387748 4210.522 -311.13393 Sep 4 -6.607645 4159.522 287.08611 Oct 4 184.644741 4110.106 -268.75075 Nov 4 -460.303579 4060.690 508.61309 Dec 4 -61.644453 4025.378 821.26612 Jan 5 -220.568010 3990.066 -545.49816 Feb 5 -231.193654 3966.184 -182.99043 Mar 5 421.180632 3942.302 -423.48263 Apr 5 -10.856409 3912.749 11.10727 May 5 161.772721 3883.196 -363.96899 Jun 5 688.523091 3858.897 -238.42027 Jul 5 -393.559569 3834.598 388.96149 Aug 5 -71.387748 3866.572 347.81610 Sep 5 -6.607645 3898.545 195.06244 Oct 5 184.644741 4014.396 -381.04045 Nov 5 -460.303579 4130.246 -289.94264 Dec 5 -61.644453 4276.156 -784.51114 Jan 6 -220.568010 4422.065 -743.49696 Feb 6 -231.193654 4565.317 -364.12289 Mar 6 421.180632 4708.568 130.25125 Apr 6 -10.856409 4861.631 173.22506 May 6 161.772721 5014.695 457.53270 Jun 6 688.523091 5180.614 679.86340 Jul 6 -393.559569 5346.532 -276.97288 > m$win s t l 671 19 13 > m$deg s t l 0 1 1 > m$jump s t l 68 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/1688t1291988621.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/2zi7e1291988621.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/3zi7e1291988621.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/4s97z1291988621.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/561mp1291988621.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/69jlv1291988621.tab") > > try(system("convert tmp/1688t1291988621.ps tmp/1688t1291988621.png",intern=TRUE)) character(0) > try(system("convert tmp/2zi7e1291988621.ps tmp/2zi7e1291988621.png",intern=TRUE)) character(0) > try(system("convert tmp/3zi7e1291988621.ps tmp/3zi7e1291988621.png",intern=TRUE)) character(0) > try(system("convert tmp/4s97z1291988621.ps tmp/4s97z1291988621.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.452 0.883 1.614