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(68897,38683,44720,39525,45315,50380,40600,36279,42438,38064,31879,11379,70249,39253,47060,41697,38708,49267,39018,32228,40870,39383,34571,12066,70938,34077,45409,40809,37013,44953,37848,32745,39401,34931,33008,8620,68906,39556,50669,36432,40891,48428,36222,33425,39401,37967,34801,12657,69116,41519,51321,38529,41547,52073,38401,40898,40439,41888,37898,8771,68184,50530,47221,41756,45633,48138,39486,39341,41117,41629,29722,7054,56676,34870,35117,30169,30936,35699,33228,27733,33666,35429,27438,8170) > 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 27906.3525 40685.27 305.38211 Feb 1 222.5793 40722.47 -2262.05052 Mar 1 6468.3840 40759.68 -2508.06106 Apr 1 -1037.7072 40770.47 -207.76132 May 1 559.9180 40781.26 3973.82204 Jun 1 7595.9573 40793.12 1990.92007 Jul 1 -1515.1507 40804.99 1310.16535 Aug 1 -4607.0956 40842.06 44.03262 Sep 1 420.5285 40879.14 1138.33091 Oct 1 -639.2527 40823.03 -2119.77886 Nov 1 -6260.8888 40766.92 -2627.03365 Dec 1 -29113.6231 40599.89 -107.26776 Jan 2 27906.3525 40432.86 1909.78817 Feb 2 222.5793 40326.07 -1295.64449 Mar 2 6468.3840 40219.27 372.34495 Apr 2 -1037.7072 40210.54 2524.17216 May 2 559.9180 40201.80 -2053.71701 Jun 2 7595.9573 40211.66 1459.38249 Jul 2 -1515.1507 40221.52 311.62925 Aug 2 -4607.0956 40114.45 -3279.35292 Sep 2 420.5285 40007.38 442.09592 Oct 2 -639.2527 39850.79 171.46486 Nov 2 -6260.8888 39694.20 1137.68879 Dec 2 -29113.6231 39540.98 1638.64614 Jan 3 27906.3525 39387.75 3643.89353 Feb 3 222.5793 39222.32 -5367.89849 Mar 3 6468.3840 39056.88 -116.26843 Apr 3 -1037.7072 38836.44 3010.26269 May 3 559.9180 38616.00 -2162.92257 Jun 3 7595.9573 38484.17 -1127.13106 Jul 3 -1515.1507 38352.34 1010.80769 Aug 3 -4607.0956 38449.21 -1097.11812 Sep 3 420.5285 38546.08 434.38709 Oct 3 -639.2527 38724.48 -3154.22477 Nov 3 -6260.8888 38902.87 366.01836 Dec 3 -29113.6231 39060.14 -1326.52020 Jan 4 27906.3525 39217.42 1782.23129 Feb 4 222.5793 39311.67 21.75039 Mar 4 6468.3840 39405.92 4794.69158 Apr 4 -1037.7072 39500.88 -2031.17406 May 4 559.9180 39595.84 735.24392 Jun 4 7595.9573 39691.97 1140.07421 Jul 4 -1515.1507 39788.10 -2050.94825 Aug 4 -4607.0956 39908.77 -1876.66952 Sep 4 420.5285 40029.43 -1048.95976 Oct 4 -639.2527 40210.16 -1603.90903 Nov 4 -6260.8888 40390.89 670.99669 Dec 4 -29113.6231 40670.21 1100.41057 Jan 5 27906.3525 40949.53 260.11449 Feb 5 222.5793 41256.40 40.01602 Mar 5 6468.3840 41563.28 3289.33964 Apr 5 -1037.7072 41758.93 -2192.22244 May 5 559.9180 41954.58 -967.50090 Jun 5 7595.9573 42006.29 2470.75645 Jul 5 -1515.1507 42057.99 -2141.83893 Aug 5 -4607.0956 42151.01 3354.08450 Sep 5 420.5285 42244.03 -2225.56105 Oct 5 -639.2527 42365.47 161.78344 Nov 5 -6260.8888 42486.91 1671.98291 Dec 5 -29113.6231 42532.86 -4648.24031 Jan 6 27906.3525 42578.82 -2301.17347 Feb 6 222.5793 42560.01 7747.40899 Mar 6 6468.3840 42541.20 -1788.58646 Apr 6 -1037.7072 42384.76 408.94289 May 6 559.9180 42228.33 2844.75585 Jun 6 7595.9573 41674.15 -1132.10736 Jul 6 -1515.1507 41119.97 -118.82332 Aug 6 -4607.0956 40136.89 3811.20323 Sep 6 420.5285 39153.81 1542.66080 Oct 6 -639.2527 38010.61 4257.64311 Nov 6 -6260.8888 36867.41 -884.51959 Dec 6 -29113.6231 35795.46 372.16552 Jan 7 27906.3525 34723.51 -5953.85932 Feb 7 222.5793 33904.45 742.97492 Mar 7 6468.3840 33085.38 -4436.76873 Apr 7 -1037.7072 33062.13 -1855.42582 May 7 559.9180 33038.88 -2662.79928 Jun 7 7595.9573 33097.51 -4994.46699 Jul 7 -1515.1507 33156.14 1587.01255 Aug 7 -4607.0956 33292.47 -952.36978 Sep 7 420.5285 33428.79 -183.32108 Oct 7 -639.2527 33652.96 2415.29431 Nov 7 -6260.8888 33877.12 -178.23531 Dec 7 -29113.6231 34164.06 3119.55943 > m$win s t l 841 19 13 > m$deg s t l 0 1 1 > m$jump s t l 85 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/wessaorg/rcomp/tmp/1c9bi1322231596.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/2ali51322231596.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/3mfyk1322231596.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/4lnsv1322231596.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/5inp11322231596.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/6jbu41322231596.tab") > > try(system("convert tmp/1c9bi1322231596.ps tmp/1c9bi1322231596.png",intern=TRUE)) character(0) > try(system("convert tmp/2ali51322231596.ps tmp/2ali51322231596.png",intern=TRUE)) character(0) > try(system("convert tmp/3mfyk1322231596.ps tmp/3mfyk1322231596.png",intern=TRUE)) character(0) > try(system("convert tmp/4lnsv1322231596.ps tmp/4lnsv1322231596.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.379 0.177 1.559