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(26548,26752,26967,27034,27056,27476,28497,29085,28720,29067,29249,29672,29761,30066,30315,30571,30757,30742,31310,31381,31470,31226,31081,31061,31114,30828,30418,30195,29877,29192,29876,29409,28458,28340,28164,28438,28053,27599,27226,27119,26625,26541,27023,26631,26154,26029,26008,26632,27010,27041,27244,26976,26715,27017,27714,27655,27103,27088,26968,27770,27616,27481,27279,26918,26503,26547,27467,27305,26259,26048,25743) > 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 200.18916 26321.59 26.219279 Feb 1 121.32519 26624.99 5.684533 Mar 1 45.29456 26928.39 -6.683558 Apr 1 -69.97203 27228.69 -124.718441 May 1 -292.57204 27528.99 -180.419908 Jun 1 -297.63464 27824.94 -51.304050 Jul 1 428.96950 28120.89 -52.854932 Aug 1 365.72245 28414.58 304.693492 Sep 1 -177.69091 28708.28 189.408230 Oct 1 -221.71384 28997.78 290.931437 Nov 1 -302.23668 29287.28 263.954563 Dec 1 200.31897 29547.33 -75.650854 Jan 2 200.18916 29807.38 -246.570808 Feb 2 121.32519 30028.58 -83.906370 Mar 2 45.29456 30249.78 19.924722 Apr 2 -69.97203 30435.83 205.138798 May 2 -292.57204 30621.89 427.686289 Jun 2 -297.63464 30757.65 281.989410 Jul 2 428.96950 30893.40 -12.374209 Aug 2 365.72245 30950.44 64.836362 Sep 2 -177.69091 31007.48 640.213247 Oct 2 -221.71384 30975.58 472.132962 Nov 2 -302.23668 30943.68 439.552597 Dec 2 200.31897 30831.32 29.362236 Jan 3 200.18916 30718.95 194.857337 Feb 3 121.32519 30533.72 172.950817 Mar 3 45.29456 30348.49 24.210952 Apr 3 -69.97203 30113.98 150.989788 May 3 -292.57204 29879.47 290.102039 Jun 3 -297.63464 29631.82 -142.190289 Jul 3 428.96950 29384.18 62.850643 Aug 3 365.72245 29125.36 -82.078517 Sep 3 -177.69091 28866.53 -230.841364 Oct 3 -221.71384 28607.57 -45.859477 Nov 3 -302.23668 28348.61 117.622329 Dec 3 200.31897 28106.62 131.064592 Jan 4 200.18916 27864.62 -11.807682 Feb 4 121.32519 27643.63 -165.955153 Mar 4 45.29456 27422.64 -241.935969 Apr 4 -69.97203 27229.16 -40.189031 May 4 -292.57204 27035.68 -118.108678 Jun 4 -297.63464 26897.03 -58.400070 Jul 4 428.96950 26758.39 -164.358201 Aug 4 365.72245 26698.19 -432.908089 Sep 4 -177.69091 26637.98 -306.291663 Oct 4 -221.71384 26640.29 -389.575482 Nov 4 -302.23668 26642.60 -332.359382 Dec 4 200.31897 26691.79 -260.106164 Jan 5 200.18916 26740.98 68.832516 Feb 5 121.32519 26822.03 97.641021 Mar 5 45.29456 26903.09 295.616180 Apr 5 -69.97203 26988.19 57.779470 May 5 -292.57204 27073.30 -65.723825 Jun 5 -297.63464 27140.00 174.631322 Jul 5 428.96950 27206.71 78.319729 Aug 5 365.72245 27241.75 47.527144 Sep 5 -177.69091 27276.79 3.900871 Oct 5 -221.71384 27276.98 32.737592 Nov 5 -302.23668 27277.16 -6.925768 Dec 5 200.31897 27252.09 317.590125 Jan 6 200.18916 27227.02 188.791480 Feb 6 121.32519 27167.31 192.369699 Mar 6 45.29456 27107.59 126.114571 Apr 6 -69.97203 27015.39 -27.417095 May 6 -292.57204 26923.19 -127.615346 Jun 6 -297.63464 26826.06 18.572731 Jul 6 428.96950 26728.94 309.094069 Aug 6 365.72245 26628.90 310.376017 Sep 6 -177.69091 26528.87 -92.175722 Oct 6 -221.71384 26424.83 -155.115316 Nov 6 -302.23668 26320.79 -275.554991 > m$win s t l 711 19 13 > m$deg s t l 0 1 1 > m$jump s t l 72 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/11aw31293559023.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/www/html/rcomp/tmp/2b1do1293559023.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/www/html/rcomp/tmp/3b1do1293559023.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/www/html/rcomp/tmp/4msur1293559023.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/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/502s01293559023.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/64lro1293559023.tab") > > try(system("convert tmp/11aw31293559023.ps tmp/11aw31293559023.png",intern=TRUE)) character(0) > try(system("convert tmp/2b1do1293559023.ps tmp/2b1do1293559023.png",intern=TRUE)) character(0) > try(system("convert tmp/3b1do1293559023.ps tmp/3b1do1293559023.png",intern=TRUE)) character(0) > try(system("convert tmp/4msur1293559023.ps tmp/4msur1293559023.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.019 0.668 2.412