R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(9.492,8.641,9.793,9.603,9.238,9.535,10.295,9.941,9.984,9.563,8.872,9.302,9.215,8.834,9.998,9.604,9.507,9.718,10.095,9.583,9.883,9.365,8.919,9.449,9.769,9.321,9.939,9.336,10.195,9.464,10.010,10.213,9.563,9.890,9.305,9.391,9.928,8.686,9.843,9.627,10.074,9.503,10.119,10.000,9.313,9.866,9.172,9.241,9.659,8.904,9.755,9.080,9.435,8.971,10.063,9.793,9.454,9.759,8.820,9.403,9.676,8.642,9.402,9.610,9.294,9.448,10.319,9.548,9.801,9.596,8.923,9.746,9.829,9.125,9.782,9.441,9.162,9.915,10.444,10.209,9.985,9.842,9.429,10.132,9.849,9.172,10.313,9.819,9.955,10.048,10.082,10.541,10.208,10.233,9.439,9.963,10.158,9.225,10.474,9.757,10.490,10.281,10.444,10.640,10.695,10.786,9.832,9.747,10.411,9.511,10.402,9.701,10.540,10.112,10.915,11.183,10.384,10.834,9.886,10.216,10.943,9.867,10.203,10.837,10.573,10.647,11.502,10.656,10.866,10.835,9.945,10.331) > 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.11050241 9.493940 -1.124425e-01 Feb 1 -0.71635951 9.499336 -1.419769e-01 Mar 1 0.18196041 9.504733 1.063069e-01 Apr 1 -0.14173368 9.508636 2.360982e-01 May 1 0.03793615 9.512538 -3.124744e-01 Jun 1 -0.04355042 9.515768 6.278290e-02 Jul 1 0.55378120 9.518997 2.222220e-01 Aug 1 0.36628865 9.522861 5.185061e-02 Sep 1 0.16152310 9.526725 2.957522e-01 Oct 1 0.19237964 9.530664 -1.600441e-01 Nov 1 -0.54585484 9.534604 -1.167493e-01 Dec 1 -0.15687310 9.537580 -7.870681e-02 Jan 2 0.11050241 9.540556 -4.360581e-01 Feb 2 -0.71635951 9.534051 1.630819e-02 Mar 2 0.18196041 9.527547 2.884927e-01 Apr 2 -0.14173368 9.525225 2.205088e-01 May 2 0.03793615 9.522903 -5.383893e-02 Jun 2 -0.04355042 9.532036 2.295146e-01 Jul 2 0.55378120 9.541169 4.993082e-05 Aug 2 0.36628865 9.554204 -3.374924e-01 Sep 2 0.16152310 9.567239 1.542383e-01 Oct 2 0.19237964 9.579909 -4.072886e-01 Nov 2 -0.54585484 9.592579 -1.277246e-01 Dec 2 -0.15687310 9.608584 -2.711168e-03 Jan 3 0.11050241 9.624589 3.390845e-02 Feb 3 -0.71635951 9.641598 3.957617e-01 Mar 3 0.18196041 9.658606 9.843318e-02 Apr 3 -0.14173368 9.672393 -1.946597e-01 May 3 0.03793615 9.686180 4.708834e-01 Jun 3 -0.04355042 9.687699 -1.801486e-01 Jul 3 0.55378120 9.689218 -2.329988e-01 Aug 3 0.36628865 9.678402 1.683098e-01 Sep 3 0.16152310 9.667586 -2.661086e-01 Oct 3 0.19237964 9.665581 3.203949e-02 Nov 3 -0.54585484 9.663576 1.872786e-01 Dec 3 -0.15687310 9.666858 -1.189845e-01 Jan 4 0.11050241 9.670139 1.473585e-01 Feb 4 -0.71635951 9.665332 -2.629726e-01 Mar 4 0.18196041 9.660525 5.143716e-04 Apr 4 -0.14173368 9.648176 1.205575e-01 May 4 0.03793615 9.635827 4.002367e-01 Jun 4 -0.04355042 9.623549 -7.699818e-02 Jul 4 0.55378120 9.611270 -4.605125e-02 Aug 4 0.36628865 9.597797 3.591406e-02 Sep 4 0.16152310 9.584325 -4.328476e-01 Oct 4 0.19237964 9.557625 1.159954e-01 Nov 4 -0.54585484 9.530925 1.869295e-01 Dec 4 -0.15687310 9.503102 -1.052286e-01 Jan 5 0.11050241 9.475278 7.321953e-02 Feb 5 -0.71635951 9.458931 1.614286e-01 Mar 5 0.18196041 9.442584 1.304558e-01 Apr 5 -0.14173368 9.431616 -2.098821e-01 May 5 0.03793615 9.420648 -2.358384e-02 Jun 5 -0.04355042 9.413346 -3.987952e-01 Jul 5 0.55378120 9.406044 1.031752e-01 Aug 5 0.36628865 9.404806 2.190500e-02 Sep 5 0.16152310 9.403569 -1.110922e-01 Oct 5 0.19237964 9.411916 1.547045e-01 Nov 5 -0.54585484 9.420263 -5.440771e-02 Dec 5 -0.15687310 9.434006 1.258669e-01 Jan 6 0.11050241 9.447750 1.177477e-01 Feb 6 -0.71635951 9.455144 -9.678484e-02 Mar 6 0.18196041 9.462539 -2.424992e-01 Apr 6 -0.14173368 9.467856 2.838776e-01 May 6 0.03793615 9.473173 -2.171094e-01 Jun 6 -0.04355042 9.488869 2.681240e-03 Jul 6 0.55378120 9.504565 2.606537e-01 Aug 6 0.36628865 9.528378 -3.466664e-01 Sep 6 0.16152310 9.552190 8.728651e-02 Oct 6 0.19237964 9.567040 -1.634192e-01 Nov 6 -0.54585484 9.581889 -1.130338e-01 Dec 6 -0.15687310 9.598293 3.045805e-01 Jan 7 0.11050241 9.614697 1.038009e-01 Feb 7 -0.71635951 9.639335 2.020241e-01 Mar 7 0.18196041 9.663974 -6.393468e-02 Apr 7 -0.14173368 9.689588 -1.068542e-01 May 7 0.03793615 9.715201 -5.911376e-01 Jun 7 -0.04355042 9.738024 2.205266e-01 Jul 7 0.55378120 9.760846 1.293727e-01 Aug 7 0.36628865 9.789753 5.295818e-02 Sep 7 0.16152310 9.818660 4.816610e-03 Oct 7 0.19237964 9.852413 -2.027928e-01 Nov 7 -0.54585484 9.886166 8.868880e-02 Dec 7 -0.15687310 9.906137 3.827364e-01 Jan 8 0.11050241 9.926107 -1.876098e-01 Feb 8 -0.71635951 9.936370 -4.801025e-02 Mar 8 0.18196041 9.946632 1.844075e-01 Apr 8 -0.14173368 9.957393 3.340744e-03 May 8 0.03793615 9.968154 -5.108989e-02 Jun 8 -0.04355042 9.975369 1.161813e-01 Jul 8 0.55378120 9.982584 -4.543657e-01 Aug 8 0.36628865 9.992104 1.826073e-01 Sep 8 0.16152310 10.001624 4.485325e-02 Oct 8 0.19237964 10.018519 2.210162e-02 Nov 8 -0.54585484 10.035414 -5.055898e-02 Dec 8 -0.15687310 10.058420 6.145317e-02 Jan 9 0.11050241 10.081426 -3.392844e-02 Feb 9 -0.71635951 10.108432 -1.670726e-01 Mar 9 0.18196041 10.135438 1.566013e-01 Apr 9 -0.14173368 10.164548 -2.658145e-01 May 9 0.03793615 10.193658 2.584057e-01 Jun 9 -0.04355042 10.215785 1.087653e-01 Jul 9 0.55378120 10.237912 -3.476932e-01 Aug 9 0.36628865 10.246871 2.684080e-02 Sep 9 0.16152310 10.255829 2.776478e-01 Oct 9 0.19237964 10.255817 3.378030e-01 Nov 9 -0.54585484 10.255806 1.220492e-01 Dec 9 -0.15687310 10.257732 -3.538585e-01 Jan 10 0.11050241 10.259658 4.084006e-02 Feb 10 -0.71635951 10.268587 -4.122773e-02 Mar 10 0.18196041 10.277517 -5.747736e-02 Apr 10 -0.14173368 10.290652 -4.479183e-01 May 10 0.03793615 10.303787 1.982767e-01 Jun 10 -0.04355042 10.333214 -1.776631e-01 Jul 10 0.55378120 10.362640 -1.421137e-03 Aug 10 0.36628865 10.395168 4.215430e-01 Sep 10 0.16152310 10.427697 -2.052199e-01 Oct 10 0.19237964 10.459637 1.819835e-01 Nov 10 -0.54585484 10.491577 -5.972209e-02 Dec 10 -0.15687310 10.517342 -1.444693e-01 Jan 11 0.11050241 10.543108 2.893898e-01 Feb 11 -0.71635951 10.559064 2.429518e-02 Mar 11 0.18196041 10.575021 -5.539813e-01 Apr 11 -0.14173368 10.578690 4.000433e-01 May 11 0.03793615 10.582360 -4.729602e-02 Jun 11 -0.04355042 10.584456 1.060947e-01 Jul 11 0.55378120 10.586552 3.616671e-01 Aug 11 0.36628865 10.588365 -2.986532e-01 Sep 11 0.16152310 10.590177 1.142994e-01 Oct 11 0.19237964 10.590551 5.206978e-02 Nov 11 -0.54585484 10.590924 -1.000688e-01 Dec 11 -0.15687310 10.589776 -1.019029e-01 > m$win s t l 1321 19 13 > m$deg s t l 0 1 1 > m$jump s t l 133 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/rcomp/tmp/13ykj1322600675.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/rcomp/tmp/2zme51322600675.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/rcomp/tmp/3yugh1322600675.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/rcomp/tmp/4yo7k1322600675.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/57iv81322600675.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/rcomp/tmp/6ej1e1322600675.tab") > > try(system("convert tmp/13ykj1322600675.ps tmp/13ykj1322600675.png",intern=TRUE)) character(0) > try(system("convert tmp/2zme51322600675.ps tmp/2zme51322600675.png",intern=TRUE)) character(0) > try(system("convert tmp/3yugh1322600675.ps tmp/3yugh1322600675.png",intern=TRUE)) character(0) > try(system("convert tmp/4yo7k1322600675.ps tmp/4yo7k1322600675.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.130 0.130 2.248