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(103.48,103.93,103.89,104.4,104.79,104.77,105.13,105.26,104.96,104.75,105.01,105.15,105.2,105.77,105.78,106.26,106.13,106.12,106.57,106.44,106.54,107.1,108.1,108.4,108.84,109.62,110.42,110.67,111.66,112.28,112.87,112.18,112.36,112.16,111.49,111.25,111.36,111.74,111.1,111.33,111.25,111.04,110.97,111.31,111.02,111.07,111.36,111.54,112.05,112.52,112.94,113.33,113.78,113.77,113.82,113.89,114.25,114.41) > 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 -0.37560457 103.8119 0.043732869 Feb 1 -0.01211351 103.9608 -0.018728403 Mar 1 -0.06862252 104.1098 -0.151189608 Apr 1 0.14999899 104.2578 -0.007759146 May 1 0.32062060 104.4057 0.063671219 Jun 1 0.24271618 104.5532 -0.025889340 Jul 1 0.36681171 104.7006 0.062550149 Aug 1 0.13984529 104.8492 0.270957637 Sep 1 -0.02112089 104.9978 -0.016635109 Oct 1 -0.14606078 105.1401 -0.244074011 Nov 1 -0.23946156 105.2825 -0.033052015 Dec 1 -0.35700902 105.4041 0.102942082 Jan 2 -0.37560457 105.5256 0.049984258 Feb 2 -0.01211351 105.6499 0.132234437 Mar 2 -0.06862252 105.7741 0.074484682 Apr 2 0.14999899 105.9499 0.160068036 May 2 0.32062060 106.1257 -0.316348708 Jun 2 0.24271618 106.3793 -0.502030726 Jul 2 0.36681171 106.6329 -0.429712696 Aug 2 0.13984529 106.9702 -0.670045588 Sep 2 -0.02112089 107.3075 -0.746378715 Oct 2 -0.14606078 107.7305 -0.484417713 Nov 2 -0.23946156 108.1535 0.186004187 Dec 2 -0.35700902 108.6512 0.105835096 Jan 3 -0.37560457 109.1489 0.066714085 Feb 3 -0.01211351 109.6460 -0.013860398 Mar 3 -0.06862252 110.1431 0.345565185 Apr 3 0.14999899 110.5468 -0.026778054 May 3 0.32062060 110.9505 0.388878608 Jun 3 0.24271618 111.2179 0.819376024 Jul 3 0.36681171 111.4853 1.017873490 Aug 3 0.13984529 111.6254 0.414774914 Sep 3 -0.02112089 111.7654 0.615676105 Oct 3 -0.14606078 111.7770 0.529063714 Nov 3 -0.23946156 111.7885 -0.059087779 Dec 3 -0.35700902 111.6982 -0.091200414 Jan 4 -0.37560457 111.6079 0.127735029 Feb 4 -0.01211351 111.4927 0.259460958 Mar 4 -0.06862252 111.3774 -0.208813046 Apr 4 0.14999899 111.3054 -0.125445937 May 4 0.32062060 111.2335 -0.304078927 Jun 4 0.24271618 111.2396 -0.442335760 Jul 4 0.36681171 111.2458 -0.642592544 Aug 4 0.13984529 111.3400 -0.169846166 Sep 4 -0.02112089 111.4342 -0.393100022 Oct 4 -0.14606078 111.6155 -0.399448865 Nov 4 -0.23946156 111.7968 -0.197336810 Dec 4 -0.35700902 112.0282 -0.131208910 Jan 5 -0.37560457 112.2596 0.165967069 Feb 5 -0.01211351 112.5044 0.027745120 Mar 5 -0.06862252 112.7491 0.259523238 Apr 5 0.14999899 112.9994 0.180582413 May 5 0.32062060 113.2497 0.209641490 Jun 5 0.24271618 113.4994 0.027894216 Jul 5 0.36681171 113.7490 -0.295853009 Aug 5 0.13984529 113.9953 -0.245106275 Sep 5 -0.02112089 114.2415 0.029640225 Oct 5 -0.14606078 114.4854 0.070661857 > m$win s t l 581 19 13 > m$deg s t l 0 1 1 > m$jump s t l 59 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/165bi1291745580.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/2hxt41291745580.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/3hxt41291745580.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/4a6so1291745580.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/56gqx1291745580.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/69g6l1291745580.tab") > > try(system("convert tmp/165bi1291745580.ps tmp/165bi1291745580.png",intern=TRUE)) character(0) > try(system("convert tmp/2hxt41291745580.ps tmp/2hxt41291745580.png",intern=TRUE)) character(0) > try(system("convert tmp/3hxt41291745580.ps tmp/3hxt41291745580.png",intern=TRUE)) character(0) > try(system("convert tmp/4a6so1291745580.ps tmp/4a6so1291745580.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.462 0.874 1.769