R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(13.7,13.7,13.7,1.3,1.3,1.3,-7.4,-7.4,-7.4,-12.9,-12.9,-12.9,-9.6,-9.6,-9.6,-11.1,-11.1,-11.1,-8.3,-8.3,-8.3,-2.7,-2.7,-2.7,5.1,5.1,5.1,4.6,4.6,4.6,5.6,5.6,5.6,5.1,5.1,5.1,0.8,0.8,0.8,6,6,6,9.3,9.3,9.3,8.7,8.7,8.7,11,11,11,8.5,8.5,8.5,4.4,4.4,4.4,2.5,2.5,2.5,0.3,0.3,0.3,-3,-3,-3) > 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 1.12822201 11.5508553 1.02092273 Feb 1 1.49448728 9.2470288 2.95848390 Mar 1 1.86075254 6.9432024 4.89604507 Apr 1 -0.33791736 4.7394294 -3.10151201 May 1 -0.03659363 2.5356564 -1.19906272 Jun 1 0.24466912 0.4199664 0.63536444 Jul 1 -0.93451491 -1.6957235 -4.76976161 Aug 1 -0.71992790 -3.7610749 -2.91899725 Sep 1 -0.50534090 -5.8264262 -1.06823288 Oct 1 -0.88507593 -7.3860617 -4.62886237 Nov 1 -0.68481281 -8.9456972 -3.26949001 Dec 1 -0.62394691 -9.6140014 -2.66205174 Jan 2 1.12822201 -10.2823055 -0.44591647 Feb 2 1.49448728 -10.3267105 -0.76777680 Mar 2 1.86075254 -10.3711154 -1.08963712 Apr 2 -0.33791736 -9.8505634 -0.91151927 May 2 -0.03659363 -9.3300113 -1.73339504 Jun 2 0.24466912 -8.3753686 -2.96930055 Jul 2 -0.93451491 -7.4207258 0.05524073 Aug 2 -0.71992790 -6.1877623 -1.39230976 Sep 2 -0.50534090 -4.9547989 -2.83986024 Oct 2 -0.88507593 -3.5928415 1.77791744 Nov 2 -0.68481281 -2.2308842 0.21569697 Dec 2 -0.62394691 -0.9200338 -1.15601930 Jan 3 1.12822201 0.3908166 3.58096142 Feb 3 1.49448728 1.5029933 2.10251944 Mar 3 1.86075254 2.6151700 0.62407746 Apr 3 -0.33791736 3.4085488 1.52936860 May 3 -0.03659363 4.2019275 0.43466612 Jun 3 0.24466912 4.5131593 -0.15782845 Jul 3 -0.93451491 4.8243911 1.71012377 Aug 3 -0.71992790 4.6907447 1.62918320 Sep 3 -0.50534090 4.5570983 1.54824264 Oct 3 -0.88507593 4.3888563 1.59621965 Nov 3 -0.68481281 4.2206143 1.56419850 Dec 3 -0.62394691 4.2561741 1.46777277 Jan 4 1.12822201 4.2917340 -4.61995597 Feb 4 1.49448728 4.5424832 -5.23697050 Mar 4 1.86075254 4.7932325 -5.85398503 Apr 4 -0.33791736 5.2369703 1.10094706 May 4 -0.03659363 5.6807081 0.35588553 Jun 4 0.24466912 6.3303936 -0.57506272 Jul 4 -0.93451491 6.9800791 3.25443581 Aug 4 -0.71992790 7.6717036 2.34822434 Sep 4 -0.50534090 8.3633280 1.44201287 Oct 4 -0.88507593 8.7449394 0.84013652 Nov 4 -0.68481281 9.1265508 0.25826201 Dec 4 -0.62394691 9.1068526 0.21709433 Jan 5 1.12822201 9.0871544 0.78462363 Feb 5 1.49448728 8.7645111 0.74100165 Mar 5 1.86075254 8.4418678 0.69737966 Apr 5 -0.33791736 7.9449904 0.89292698 May 5 -0.03659363 7.4481130 1.08848067 Jun 5 0.24466912 6.7810549 1.47427597 Jul 5 -0.93451491 6.1139969 -0.77948195 Aug 5 -0.71992790 5.2565548 -0.13662691 Sep 5 -0.50534090 4.3991128 0.50622813 Oct 5 -0.88507593 3.4428535 -0.05777762 Nov 5 -0.68481281 2.4865943 0.69821848 Dec 5 -0.62394691 1.5547656 1.56918126 Jan 6 1.12822201 0.6229370 -1.45115897 Feb 6 1.49448728 -0.3151799 -0.87930742 Mar 6 1.86075254 -1.2532967 -0.30745586 Apr 6 -0.33791736 -2.1972927 -0.46478992 May 6 -0.03659363 -3.1412888 0.17788239 Jun 6 0.24466912 -4.0848966 0.84022743 > m$win s t l 661 19 13 > m$deg s t l 0 1 1 > m$jump s t l 67 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/freestat/rcomp/tmp/1vj5g1293444529.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/freestat/rcomp/tmp/2vj5g1293444529.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/freestat/rcomp/tmp/36a4j1293444529.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/freestat/rcomp/tmp/4h2mm1293444529.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/5dt1d1293444529.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/freestat/rcomp/tmp/6nljx1293444529.tab") > > try(system("convert tmp/1vj5g1293444529.ps tmp/1vj5g1293444529.png",intern=TRUE)) character(0) > try(system("convert tmp/2vj5g1293444529.ps tmp/2vj5g1293444529.png",intern=TRUE)) character(0) > try(system("convert tmp/36a4j1293444529.ps tmp/36a4j1293444529.png",intern=TRUE)) character(0) > try(system("convert tmp/4h2mm1293444529.ps tmp/4h2mm1293444529.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.435 0.865 1.581