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(3111,3995,5245,5588,10681,10516,7496,9935,10249,6271,3616,3724,2886,3318,4166,6401,9209,9820,7470,8207,9564,5309,3385,3706,2733,3045,3449,5542,10072,9418,7516,7840,10081,4956,3641,3970,2931,3170,3889,4850,8037,12370,6712,7297,10613,5184,3506,3810,2692,3073,3713,4555,7807,10869,9682,7704,9826,5456,3677,3431,2765,3483,3445,6081,8767,9407,6551,12480,9530,5960,3252,3717,2642,2989,3607,5366,8898,9435,7328,8594,11349,5797,3621,3851) > 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 -3404.7230 6988.323 -472.600255 Feb 1 -2919.8869 6939.838 -24.951344 Mar 1 -2273.9080 6891.353 627.554721 Apr 1 -717.9273 6843.103 -537.175954 May 1 2869.3386 6794.853 1016.808124 Jun 1 4069.6665 6748.568 -302.234713 Jul 1 1349.4214 6702.283 -555.704644 Aug 1 2683.2150 6654.630 597.155276 Sep 1 3996.0102 6606.976 -353.986442 Oct 1 -606.9418 6555.579 322.362481 Nov 1 -2632.1790 6504.182 -256.003429 Dec 1 -2412.0855 6456.455 -320.369719 Jan 2 -3404.7230 6408.728 -118.005059 Feb 2 -2919.8869 6344.706 -106.818698 Mar 2 -2273.9080 6280.683 159.224817 Apr 2 -717.9273 6222.328 896.599237 May 2 2869.3386 6163.973 175.688410 Jun 2 4069.6665 6127.373 -377.039280 Jul 2 1349.4214 6090.773 29.805934 Aug 2 2683.2150 6053.770 -529.984527 Sep 2 3996.0102 6016.766 -448.776627 Oct 2 -606.9418 5999.723 -83.781664 Nov 2 -2632.1790 5982.681 34.498467 Dec 2 -2412.0855 5992.227 125.858882 Jan 3 -3404.7230 6001.773 135.950248 Feb 3 -2919.8869 6007.274 -42.386886 Mar 3 -2273.9080 6012.775 -289.866867 Apr 3 -717.9273 6008.876 251.051523 May 3 2869.3386 6004.977 1197.684667 Jun 3 4069.6665 6010.188 -661.854125 Jul 3 1349.4214 6015.399 151.179988 Aug 3 2683.2150 6018.930 -862.145010 Sep 3 3996.0102 6022.461 62.528354 Oct 3 -606.9418 6014.662 -451.720268 Nov 3 -2632.1790 6006.863 266.316279 Dec 3 -2412.0855 6017.565 364.520315 Jan 4 -3404.7230 6028.268 307.455303 Feb 4 -2919.8869 6039.094 50.792494 Mar 4 -2273.9080 6049.921 112.986838 Apr 4 -717.9273 6041.736 -473.809174 May 4 2869.3386 6033.552 -865.890434 Jun 4 4069.6665 6022.120 2278.213915 Jul 4 1349.4214 6010.687 -648.108831 Aug 4 2683.2150 6001.885 -1388.100449 Sep 4 3996.0102 5993.083 623.906294 Oct 4 -606.9418 5970.548 -179.606403 Nov 4 -2632.1790 5948.013 190.166067 Dec 4 -2412.0855 5958.858 263.227714 Jan 5 -3404.7230 5969.703 127.020311 Feb 5 -2919.8869 6003.284 -10.397239 Mar 5 -2273.9080 6036.866 -49.957635 Apr 5 -717.9273 6047.316 -774.389111 May 5 2869.3386 6057.767 -1120.105834 Jun 5 4069.6665 6061.601 737.732465 Jul 5 1349.4214 6065.435 2267.143668 Aug 5 2683.2150 6090.318 -1069.533471 Sep 5 3996.0102 6115.202 -285.212249 Oct 5 -606.9418 6131.215 -68.273571 Nov 5 -2632.1790 6147.229 161.950274 Dec 5 -2412.0855 6133.505 -290.419165 Jan 6 -3404.7230 6119.781 49.942348 Feb 6 -2919.8869 6148.641 254.246104 Mar 6 -2273.9080 6177.501 -458.592986 Apr 6 -717.9273 6225.097 573.830291 May 6 2869.3386 6272.693 -375.031678 Jun 6 4069.6665 6282.174 -944.840322 Jul 6 1349.4214 6291.655 -1090.076061 Aug 6 2683.2150 6281.079 3515.705543 Sep 6 3996.0102 6270.504 -736.514493 Oct 6 -606.9418 6252.672 314.269785 Nov 6 -2632.1790 6234.840 -350.660770 Dec 6 -2412.0855 6191.384 -62.298781 Jan 7 -3404.7230 6147.929 -101.205842 Feb 7 -2919.8869 6101.860 -192.973391 Mar 7 -2273.9080 6055.792 -174.883786 Apr 7 -717.9273 6087.556 -3.629052 May 7 2869.3386 6119.321 -90.659564 Jun 7 4069.6665 6146.602 -781.268642 Jul 7 1349.4214 6173.883 -195.304816 Aug 7 2683.2150 6206.157 -295.372313 Sep 7 3996.0102 6238.431 1114.558552 Oct 7 -606.9418 6279.070 124.871848 Nov 7 -2632.1790 6319.709 -66.529687 Dec 7 -2412.0855 6365.019 -101.933931 > 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/www/html/rcomp/tmp/1ehhy1292748837.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/2ehhy1292748837.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/378gj1292748837.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/478gj1292748837.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/53iws1292748837.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/6oidg1292748837.tab") > > try(system("convert tmp/1ehhy1292748837.ps tmp/1ehhy1292748837.png",intern=TRUE)) character(0) > try(system("convert tmp/2ehhy1292748837.ps tmp/2ehhy1292748837.png",intern=TRUE)) character(0) > try(system("convert tmp/378gj1292748837.ps tmp/378gj1292748837.png",intern=TRUE)) character(0) > try(system("convert tmp/478gj1292748837.ps tmp/478gj1292748837.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.066 0.626 4.944