R version 2.9.0 (2009-04-17) Copyright (C) 2009 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. 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(6.3,6.2,6.1,6.3,6.5,6.6,6.5,6.2,6.2,5.9,6.1,6.1,6.1,6.1,6.1,6.4,6.7,6.9,7,7,6.8,6.4,5.9,5.5,5.5,5.6,5.8,5.9,6.1,6.1,6,6,5.9,5.5,5.6,5.4,5.2,5.2,5.2,5.5,5.8,5.8,5.5,5.3,5.1,5.2,5.8,5.8,5.5,5,4.9,5.3,6.1,6.5,6.8,6.6,6.4,6.4,6.6) > 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.255846341 6.436550 0.119296593 Feb 1 -0.354688321 6.403674 0.151014033 Mar 1 -0.353530383 6.370799 0.082731556 Apr 1 -0.096654259 6.343551 0.053103409 May 1 0.260221782 6.316303 -0.076524654 Jun 1 0.395745007 6.293930 -0.089674734 Jul 1 0.371268232 6.271557 -0.142824813 Aug 1 0.230562299 6.251601 -0.282163187 Sep 1 0.089856230 6.231645 -0.121501423 Oct 1 -0.116353555 6.233685 -0.217331170 Nov 1 -0.002563339 6.235724 -0.133160917 Dec 1 -0.168017091 6.271108 -0.003091167 Jan 2 -0.255846341 6.306492 0.049354081 Feb 2 -0.354688321 6.355895 0.098793277 Mar 2 -0.353530383 6.405298 0.048232556 Apr 2 -0.096654259 6.432291 0.064363351 May 2 0.260221782 6.459284 -0.019505771 Jun 2 0.395745007 6.437666 0.066589026 Jul 2 0.371268232 6.416048 0.212683823 Aug 2 0.230562299 6.368727 0.400710944 Sep 2 0.089856230 6.321406 0.388738201 Oct 2 -0.116353555 6.265923 0.250430245 Nov 2 -0.002563339 6.210441 -0.307877712 Dec 2 -0.168017091 6.139607 -0.471589488 Jan 3 -0.255846341 6.068772 -0.312925766 Feb 3 -0.354688321 5.996209 -0.041520246 Mar 3 -0.353530383 5.923645 0.229885357 Apr 3 -0.096654259 5.875067 0.121587251 May 3 0.260221782 5.826489 0.013289227 Jun 3 0.395745007 5.796070 -0.091814939 Jul 3 0.371268232 5.765651 -0.136919105 Aug 3 0.230562299 5.730535 0.038902638 Sep 3 0.089856230 5.695419 0.114724517 Oct 3 -0.116353555 5.662120 -0.045766913 Nov 3 -0.002563339 5.628822 -0.026258343 Dec 3 -0.168017091 5.596173 -0.028156119 Jan 4 -0.255846341 5.563525 -0.107678397 Feb 4 -0.354688321 5.519956 0.034732696 Mar 4 -0.353530383 5.476387 0.077143872 Apr 4 -0.096654259 5.448317 0.148337289 May 4 0.260221782 5.420247 0.119530789 Jun 4 0.395745007 5.422561 -0.018305800 Jul 4 0.371268232 5.424874 -0.296142388 Aug 4 0.230562299 5.428566 -0.359128343 Sep 4 0.089856230 5.432258 -0.422114159 Oct 4 -0.116353555 5.443336 -0.126982310 Nov 4 -0.002563339 5.454414 0.348149540 Dec 4 -0.168017091 5.510411 0.457606330 Jan 5 -0.255846341 5.566408 0.189438618 Feb 5 -0.354688321 5.661447 -0.306758861 Mar 5 -0.353530383 5.756487 -0.502956257 Apr 5 -0.096654259 5.854174 -0.457519819 May 5 0.260221782 5.951862 -0.112083299 Jun 5 0.395745007 6.049795 0.054460281 Jul 5 0.371268232 6.147728 0.281003861 Aug 5 0.230562299 6.250252 0.119185245 Sep 5 0.089856230 6.352777 -0.042633233 Oct 5 -0.116353555 6.459600 0.056753069 Nov 5 -0.002563339 6.566424 0.036139371 > m$win s t l 591 19 13 > m$deg s t l 0 1 1 > m$jump s t l 60 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/12nsq1259947125.ps",horizontal=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/rcomp/tmp/24x5p1259947125.ps",horizontal=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/rcomp/tmp/3l2rx1259947125.ps",horizontal=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/rcomp/tmp/438j61259947125.ps",horizontal=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/5opum1259947125.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/rcomp/tmp/651141259947125.tab") > system("convert tmp/12nsq1259947125.ps tmp/12nsq1259947125.png") > system("convert tmp/24x5p1259947125.ps tmp/24x5p1259947125.png") > system("convert tmp/3l2rx1259947125.ps tmp/3l2rx1259947125.png") > system("convert tmp/438j61259947125.ps tmp/438j61259947125.png") > > > proc.time() user system elapsed 0.954 0.617 1.452