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(19915,19843,19761,20858,21968,23061,22661,22269,21857,21568,21274,20987,19683,19381,19071,20772,22485,24181,23479,22782,22067,21489,20903,20330,19736,19483,19242,20334,21423,22523,21986,21462,20908,20575,20237,19904,19610,19251,18941,20450,21946,23409,22741,22069,21539,21189,20960,20704,19697,19598,19456,20316,21083,22158,21469,20892,20578,20233,19947,20049) > 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 -1350.68353 21329.51 -63.821709 Feb 1 -1547.31074 21324.10 66.208992 Mar 1 -1743.93793 21318.70 186.239672 Apr 1 -476.14822 21313.13 21.019334 May 1 774.84151 21307.56 -114.401023 Jun 1 2073.64146 21299.87 -312.515585 Jul 1 1487.84123 21292.19 -119.029979 Aug 1 932.34640 21280.92 55.729094 Sep 1 444.25152 21269.66 143.088222 Oct 1 92.92976 21268.37 206.695552 Nov 1 -225.99201 21267.09 232.902881 Dec 1 -461.77960 21305.65 143.130859 Jan 2 -1350.68353 21344.21 -310.524828 Feb 2 -1547.31074 21386.36 -458.044593 Mar 2 -1743.93793 21428.50 -613.564380 Apr 2 -476.14822 21443.99 -195.842585 May 2 774.84151 21459.48 250.679189 Jun 2 2073.64146 21456.77 650.586163 Jul 2 1487.84123 21454.07 537.093304 Aug 2 932.34640 21438.10 411.549213 Sep 2 444.25152 21422.14 200.605177 Oct 2 92.92976 21360.55 35.522381 Nov 2 -225.99201 21298.95 -169.960415 Dec 2 -461.77960 21190.29 -398.513665 Jan 3 -1350.68353 21081.63 5.049422 Feb 3 -1547.31074 20976.44 53.873066 Mar 3 -1743.93793 20871.24 114.696688 Apr 3 -476.14822 20796.50 13.643473 May 3 774.84151 20721.77 -73.609762 Jun 3 2073.64146 20677.45 -228.091928 Jul 3 1487.84123 20633.13 -134.973925 Aug 3 932.34640 20614.09 -84.437895 Sep 3 444.25152 20595.05 -131.301811 Oct 3 92.92976 20612.61 -130.541636 Nov 3 -225.99201 20630.17 -167.181461 Dec 3 -461.77960 20683.86 -318.082921 Jan 4 -1350.68353 20737.55 223.131954 Feb 4 -1547.31074 20802.58 -4.268451 Mar 4 -1743.93793 20867.61 -182.668878 Apr 4 -476.14822 20927.19 -1.037019 May 4 774.84151 20986.76 184.394820 Jun 4 2073.64146 21031.95 303.408137 Jul 4 1487.84123 21077.14 176.021622 Aug 4 932.34640 21100.28 36.373870 Sep 4 444.25152 21123.42 -28.673826 Oct 4 92.92976 21104.40 -8.333799 Nov 4 -225.99201 21085.39 100.606228 Dec 4 -461.77960 21011.24 154.535072 Jan 5 -1350.68353 20937.10 110.580251 Feb 5 -1547.31074 20838.17 307.137342 Mar 5 -1743.93793 20739.24 460.694411 Apr 5 -476.14822 20648.77 143.377486 May 5 774.84151 20558.30 -250.139459 Jun 5 2073.64146 20475.67 -391.312590 Jul 5 1487.84123 20393.04 -411.885552 Aug 5 932.34640 20307.77 -348.112556 Sep 5 444.25152 20222.49 -88.739504 Oct 5 92.92976 20139.04 1.035084 Nov 5 -225.99201 20055.58 117.409673 Dec 5 -461.77960 19976.37 534.413386 > 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/www/html/rcomp/tmp/1sath1260974068.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/2w4q81260974068.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/3qric1260974068.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/44qg71260974068.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/56s331260974068.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/604su1260974068.tab") > try(system("convert tmp/1sath1260974068.ps tmp/1sath1260974068.png",intern=TRUE)) character(0) > try(system("convert tmp/2w4q81260974068.ps tmp/2w4q81260974068.png",intern=TRUE)) character(0) > try(system("convert tmp/3qric1260974068.ps tmp/3qric1260974068.png",intern=TRUE)) character(0) > try(system("convert tmp/44qg71260974068.ps tmp/44qg71260974068.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.959 0.603 1.436