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(9.911,8.915,9.452,9.112,8.472,8.230,8.384,8.625,8.221,8.649,8.625,10.443,10.357,8.586,8.892,8.329,8.101,7.922,8.120,7.838,7.735,8.406,8.209,9.451,10.041,9.411,10.405,8.467,8.464,8.102,7.627,7.513,7.510,8.291,8.064,9.383,9.706,8.579,9.474,8.318,8.213,8.059,9.111,7.708,7.680,8.014,8.007,8.718,9.486,9.113,9.025,8.476,7.952,7.759,7.835,7.600,7.651,8.319,8.812,8.630) > 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 1.30108166 8.730648 -0.1207292759 Feb 1 0.32594771 8.758336 -0.1692840380 Mar 1 0.85901425 8.786025 -0.1930392852 Apr 1 -0.04563989 8.808325 0.3493152315 May 1 -0.34109326 8.830624 -0.0175310107 Jun 1 -0.55906374 8.847235 -0.0581714040 Jul 1 -0.35003422 8.863846 -0.1298118008 Aug 1 -0.70830090 8.874692 0.4586089093 Sep 1 -0.80536725 8.885538 0.1408292935 Oct 1 -0.22768575 8.863954 0.0127318986 Nov 1 -0.21880451 8.842370 0.0014347613 Dec 1 0.76994558 8.793098 0.8799564451 Jan 2 1.30108166 8.743826 0.3120921382 Feb 2 0.32594771 8.694198 -0.4341453296 Mar 2 0.85901425 8.644569 -0.6115832824 Apr 2 -0.04563989 8.598121 -0.2234815496 May 2 -0.34109326 8.551674 -0.1095805756 Jun 2 -0.55906374 8.531595 -0.0505309407 Jul 2 -0.35003422 8.511516 -0.0414813093 Aug 2 -0.70830090 8.546847 -0.0005463287 Sep 2 -0.80536725 8.582179 -0.0418116741 Oct 2 -0.22768575 8.632745 0.0009405546 Nov 2 -0.21880451 8.683311 -0.2555069591 Dec 2 0.76994558 8.697876 -0.0168214338 Jan 3 1.30108166 8.712440 0.0274781010 Feb 3 0.32594771 8.697081 0.3879717291 Mar 3 0.85901425 8.681721 0.8642648722 Apr 3 -0.04563989 8.655554 -0.1429140093 May 3 -0.34109326 8.629387 0.1757063503 Jun 3 -0.55906374 8.592172 0.0688913624 Jul 3 -0.35003422 8.554958 -0.5779236290 Aug 3 -0.70830090 8.507806 -0.2865049151 Sep 3 -0.80536725 8.460654 -0.1452865272 Oct 3 -0.22768575 8.435962 0.0827240736 Nov 3 -0.21880451 8.411270 -0.1284650679 Dec 3 0.76994558 8.433981 0.1790731500 Jan 4 1.30108166 8.456693 -0.0517746226 Feb 4 0.32594771 8.490706 -0.2376536326 Mar 4 0.85901425 8.524719 0.0902668724 Apr 4 -0.04563989 8.529264 -0.1656245263 May 4 -0.34109326 8.533810 0.0202833161 Jun 4 -0.55906374 8.517275 0.1007888828 Jul 4 -0.35003422 8.500740 0.9602944459 Aug 4 -0.70830090 8.485567 -0.0692659675 Sep 4 -0.80536725 8.470394 0.0149732931 Oct 4 -0.22768575 8.448284 -0.2065981665 Nov 4 -0.21880451 8.426174 -0.2003693686 Dec 4 0.76994558 8.391871 -0.4438169133 Jan 5 1.30108166 8.357569 -0.1726504487 Feb 5 0.32594771 8.338695 0.4483568256 Mar 5 0.85901425 8.319822 -0.1538363851 Apr 5 -0.04563989 8.338453 0.1831867926 May 5 -0.34109326 8.357084 -0.0639907885 Jun 5 -0.55906374 8.368500 -0.0504358031 Jul 5 -0.35003422 8.379915 -0.1948808212 Aug 5 -0.70830090 8.389626 -0.0813251146 Sep 5 -0.80536725 8.399337 0.0570302660 Oct 5 -0.22768575 8.409670 0.1370155584 Nov 5 -0.21880451 8.420003 0.6108011085 Dec 5 0.76994558 8.430945 -0.5708909342 > 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/1wc1c1322570219.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/2ubf31322570219.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/3szc21322570219.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/4rwy41322570219.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/5rlhi1322570219.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/66sja1322570219.tab") > > try(system("convert tmp/1wc1c1322570219.ps tmp/1wc1c1322570219.png",intern=TRUE)) character(0) > try(system("convert tmp/2ubf31322570219.ps tmp/2ubf31322570219.png",intern=TRUE)) character(0) > try(system("convert tmp/3szc21322570219.ps tmp/3szc21322570219.png",intern=TRUE)) character(0) > try(system("convert tmp/4rwy41322570219.ps tmp/4rwy41322570219.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.463 0.224 1.749