R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-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(11.73,11.74,11.65,11.38,11.53,11.75,11.82,11.83,11.63,11.55,11.4,11.4,11.63,11.46,11.35,11.7,11.52,11.64,11.9,11.73,11.7,11.54,11.97,11.64,11.98,11.79,11.66,11.96,11.83,12.36,12.53,12.55,12.53,12.24,12.34,12.05,12.22,12.23,11.92,12.13,12.1,12.15,12.23,12.08,12.02,11.93,12.16,11.87,11.93,11.79,11.43,11.63,11.93,11.89,11.83,11.59,12.04,11.81,11.9,11.72,11.91,11.94,11.91,11.84,12.01,11.89,11.8,11.7,11.5,11.76,11.61,11.27,11.64,11.39,11.54,11.62,11.59,11.44,11.31,11.56,11.4,11.51,11.5,11.24,11.8) > par8 = 'FALSE' > par7 = '1' > par6 = '' > par5 = '1' > par4 = '' > par3 = '0' > par2 = 'periodic' > par1 = '12' > main = 'Seasonal Decomposition by Loess' > par8 <- 'FALSE' > par7 <- '1' > par6 <- '' > par5 <- '1' > par4 <- '' > par3 <- '0' > par2 <- 'periodic' > par1 <- '12' > #'GNU S' R Code compiled by R2WASP v. 1.2.327 () > #Author: root > #To cite this work: Wessa P., (2013), Decomposition by Loess (v1.0.2) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_decomposeloess.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > # > 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.086164842 11.69701 -0.053172077 Feb 1 -0.041727195 11.68348 0.098249219 Mar 1 -0.162316051 11.66995 0.142367333 Apr 1 -0.045111571 11.65643 -0.231320397 May 1 -0.006478692 11.64292 -0.106436527 Jun 1 0.081678890 11.62916 0.039159055 Jul 1 0.125550739 11.61541 0.079040369 Aug 1 0.072696002 11.60248 0.154828075 Sep 1 0.042698674 11.58954 -0.002241627 Oct 1 -0.024113358 11.58259 -0.008475594 Nov 1 0.054789111 11.57563 -0.230424060 Dec 1 -0.183831440 11.57426 0.009575911 Jan 2 0.086164842 11.57288 -0.029040951 Feb 2 -0.041727195 11.57603 -0.074297879 Mar 2 -0.162316051 11.57917 -0.066857988 Apr 2 -0.045111571 11.59467 0.150437846 May 2 -0.006478692 11.61017 -0.083694719 Jun 2 0.081678890 11.63533 -0.077007961 Jul 2 0.125550739 11.66048 0.113964529 Aug 2 0.072696002 11.68755 -0.030250259 Sep 2 0.042698674 11.71462 -0.057322456 Oct 2 -0.024113358 11.74401 -0.179901207 Nov 2 0.054789111 11.77341 0.141805542 Dec 2 -0.183831440 11.81754 0.006292541 Jan 3 0.086164842 11.86167 0.032162706 Feb 3 -0.041727195 11.92107 -0.089345901 Mar 3 -0.162316051 11.98047 -0.158157690 Apr 3 -0.045111571 12.03766 -0.032545477 May 3 -0.006478692 12.09484 -0.258361663 Jun 3 0.081678890 12.13639 0.141927629 Jul 3 0.125550739 12.17795 0.226502653 Aug 3 0.072696002 12.20673 0.270569922 Sep 3 0.042698674 12.23552 0.251779781 Oct 3 -0.024113358 12.24582 0.018297315 Nov 3 0.054789111 12.25611 0.029100349 Dec 3 -0.183831440 12.24140 -0.007570015 Jan 4 0.086164842 12.22669 -0.092857214 Feb 4 -0.041727195 12.19588 0.075846988 Mar 4 -0.162316051 12.16507 -0.082751992 Apr 4 -0.045111571 12.13832 0.036791821 May 4 -0.006478692 12.11157 -0.005092765 Jun 4 0.081678890 12.08951 -0.021187650 Jul 4 0.125550739 12.06745 0.037003196 Aug 4 0.072696002 12.03841 -0.031101880 Sep 4 0.042698674 12.00937 -0.032064366 Oct 4 -0.024113358 11.97718 -0.023066867 Nov 4 0.054789111 11.94499 0.160216132 Dec 4 -0.183831440 11.91539 0.138441488 Jan 5 0.086164842 11.88579 -0.041949990 Feb 5 -0.041727195 11.86064 -0.028913368 Mar 5 -0.162316051 11.83550 -0.243179929 Apr 5 -0.045111571 11.81849 -0.143377985 May 5 -0.006478692 11.80148 0.134995560 Jun 5 0.081678890 11.79740 0.010925764 Jul 5 0.125550739 11.79331 -0.088858300 Aug 5 0.072696002 11.80635 -0.289044467 Sep 5 0.042698674 11.81939 0.177911958 Oct 5 -0.024113358 11.83805 -0.003934428 Nov 5 0.054789111 11.85671 -0.011495315 Dec 5 -0.183831440 11.86546 0.038366951 Jan 6 0.086164842 11.87422 -0.050387616 Feb 6 -0.041727195 11.86721 0.114518216 Mar 6 -0.162316051 11.86020 0.212120867 Apr 6 -0.045111571 11.83732 0.047793662 May 6 -0.006478692 11.81444 0.202038057 Jun 6 0.081678890 11.78128 0.027039516 Jul 6 0.125550739 11.74812 -0.073673294 Aug 6 0.072696002 11.71112 -0.083818842 Sep 6 0.042698674 11.67412 -0.216821799 Oct 6 -0.024113358 11.64311 0.141005056 Nov 6 0.054789111 11.61209 -0.056882590 Dec 6 -0.183831440 11.58617 -0.132334067 Jan 7 0.086164842 11.56024 -0.006402378 Feb 7 -0.041727195 11.53951 -0.107787036 Mar 7 -0.162316051 11.51879 0.183525125 Apr 7 -0.045111571 11.50649 0.158624311 May 7 -0.006478692 11.49418 0.102295097 Jun 7 0.081678890 11.49131 -0.132989183 Jul 7 0.125550739 11.48844 -0.303987732 Aug 7 0.072696002 11.48543 0.001872431 Sep 7 0.042698674 11.48243 -0.125124816 Oct 7 -0.024113358 11.47980 0.054309395 Nov 7 0.054789111 11.47718 -0.031970894 Dec 7 -0.183831440 11.47620 -0.052372541 Jan 8 0.086164842 11.47523 0.238608978 > m$win s t l 851 19 13 > m$deg s t l 0 1 1 > m$jump s t l 86 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/fisher/rcomp/tmp/1ailv1385116172.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/fisher/rcomp/tmp/28mjr1385116172.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/fisher/rcomp/tmp/32zgb1385116172.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/fisher/rcomp/tmp/4y6by1385116172.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/5fxe61385116173.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/fisher/rcomp/tmp/6zyr31385116173.tab") > > try(system("convert tmp/1ailv1385116172.ps tmp/1ailv1385116172.png",intern=TRUE)) character(0) > try(system("convert tmp/28mjr1385116172.ps tmp/28mjr1385116172.png",intern=TRUE)) character(0) > try(system("convert tmp/32zgb1385116172.ps tmp/32zgb1385116172.png",intern=TRUE)) character(0) > try(system("convert tmp/4y6by1385116172.ps tmp/4y6by1385116172.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.554 0.520 3.059