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(46,62,66,59,58,61,41,27,58,70,49,59,44,36,72,45,56,54,53,35,61,52,47,51,52,63,74,45,51,64,36,30,55,64,39,40,63,45,59,55,40,64,27,28,45,57,45,69,60,56,58,50,51,53,37,22,55,70,62,58,39,49,58,47,42,62,39,40,72,70,54,65) > 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.06327449 56.64134 -9.57806473 Feb 1 0.09949927 56.20741 5.69308642 Mar 1 12.76228583 55.77349 -2.53577523 Apr 1 -1.64060804 55.31517 5.32544196 May 1 -2.21016421 54.85684 5.35332145 Jun 1 7.74803404 54.39494 -1.14297716 Jul 1 -13.12710605 53.93304 0.19406257 Aug 1 -21.68003658 53.40800 -4.72796576 Sep 1 5.60036095 52.88296 -0.48332215 Oct 1 11.70944271 52.22164 6.06891901 Nov 1 -2.84814305 51.56032 0.28782768 Dec 1 4.64971234 51.48097 2.86932054 Jan 2 -1.06327449 51.40162 -6.33834438 Feb 2 0.09949927 51.60816 -15.70765671 Mar 2 12.76228583 51.81470 7.42301816 Apr 2 -1.64060804 51.76061 -5.11999769 May 2 -2.21016421 51.70652 6.50364875 Jun 2 7.74803404 51.79417 -5.54220086 Jul 2 -13.12710605 51.88182 14.24528786 Aug 2 -21.68003658 52.36742 4.31261835 Sep 2 5.60036095 52.85302 2.54662078 Oct 2 11.70944271 53.03839 -12.74783172 Nov 2 -2.84814305 53.22376 -3.37561671 Dec 2 4.64971234 53.07283 -6.72254499 Jan 3 -1.06327449 52.92191 0.14136896 Feb 3 0.09949927 52.75729 10.14320927 Mar 3 12.76228583 52.59268 8.64503677 Apr 3 -1.64060804 52.45997 -5.81936168 May 3 -2.21016421 52.32726 0.88290217 Jun 3 7.74803404 51.86026 4.39170698 Jul 3 -13.12710605 51.39326 -2.26614987 Aug 3 -21.68003658 50.73533 0.94470794 Sep 3 5.60036095 50.07740 -0.67776231 Oct 3 11.70944271 49.66398 2.62657553 Nov 3 -2.84814305 49.25056 -7.40241912 Dec 3 4.64971234 48.94970 -13.59941070 Jan 4 -1.06327449 48.64883 15.41443994 Feb 4 0.09949927 48.33299 -3.43249021 Mar 4 12.76228583 48.01715 -1.77943317 Apr 4 -1.64060804 47.94244 8.69816592 May 4 -2.21016421 47.86774 -5.65757271 Jun 4 7.74803404 48.35088 7.90108848 Jul 4 -13.12710605 48.83402 -8.70691200 Aug 4 -21.68003658 49.30869 0.37134810 Sep 4 5.60036095 49.78336 -10.38371987 Oct 4 11.70944271 50.12449 -4.83393371 Nov 4 -2.84814305 50.46562 -2.61748004 Dec 4 4.64971234 50.69762 13.65266604 Jan 5 -1.06327449 50.92962 10.13365434 Feb 5 0.09949927 51.17208 4.72842101 Mar 5 12.76228583 51.41454 -6.17682514 Apr 5 -1.64060804 51.65577 -0.01515903 May 5 -2.21016421 51.89699 1.31316938 Jun 5 7.74803404 51.69705 -6.44508592 Jul 5 -13.12710605 51.49711 -1.37000288 Aug 5 -21.68003658 51.09890 -7.41886557 Sep 5 5.60036095 50.70070 -1.30105632 Oct 5 11.70944271 50.47210 7.81845276 Nov 5 -2.84814305 50.24351 14.60462934 Dec 5 4.64971234 50.34051 3.00978182 Jan 6 -1.06327449 50.43750 -10.37422347 Feb 6 0.09949927 50.91914 -2.01864081 Mar 6 12.76228583 51.40079 -6.16307095 Apr 6 -1.64060804 52.33994 -3.69932922 May 6 -2.21016421 53.27909 -9.06892520 Jun 6 7.74803404 54.16999 0.08197427 Jul 6 -13.12710605 55.06089 -2.93378792 Aug 6 -21.68003658 56.07902 5.60101954 Sep 6 5.60036095 57.09714 9.30249894 Oct 6 11.70944271 58.24685 0.04371157 Nov 6 -2.84814305 59.39655 -2.54840829 Dec 6 4.64971234 60.60692 -0.25663085 > m$win s t l 721 19 13 > m$deg s t l 0 1 1 > m$jump s t l 73 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1jnu51324637025.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/2khtd1324637025.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/3azda1324637025.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/4b9vn1324637026.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/5ycm51324637026.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/69gtd1324637026.tab") > > try(system("convert tmp/1jnu51324637025.ps tmp/1jnu51324637025.png",intern=TRUE)) character(0) > try(system("convert tmp/2khtd1324637025.ps tmp/2khtd1324637025.png",intern=TRUE)) character(0) > try(system("convert tmp/3azda1324637025.ps tmp/3azda1324637025.png",intern=TRUE)) character(0) > try(system("convert tmp/4b9vn1324637026.ps tmp/4b9vn1324637026.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.267 0.242 1.545