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(14.3,14.2,15.9,15.3,15.5,15.1,15,12.1,15.8,16.9,15.1,13.7,14.8,14.7,16,15.4,15,15.5,15.1,11.7,16.3,16.7,15,14.9,14.6,15.3,17.9,16.4,15.4,17.9,15.9,13.9,17.8,17.9,17.4,16.7,16,16.6,19.1,17.8,17.2,18.6,16.3,15.1,19.2,17.7,19.1,18,17.5,17.8,21.1,17.2,19.4,19.8,17.6,16.2,19.5,19.9,20,17.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 -0.76991970 14.86439 0.20552863 Feb 1 -0.55465121 14.88040 -0.12574659 Mar 1 1.66061694 14.89640 -0.65702149 Apr 1 0.03068761 14.91020 0.35911526 May 1 0.06075671 14.92399 0.51525358 Jun 1 0.89308776 14.93687 -0.72996160 Jul 1 -0.55458236 14.94976 0.60482440 Aug 1 -2.78797194 14.96414 -0.07617205 Sep 1 1.07863881 14.97853 -0.25716883 Oct 1 1.11384167 14.98707 0.79909323 Nov 1 0.54904531 14.99560 -0.44464550 Dec 1 -0.71954950 14.99318 -0.57363400 Jan 2 -0.76991970 14.99077 0.57915288 Feb 2 -0.55465121 14.99282 0.26183414 Mar 2 1.66061694 14.99487 -0.65548428 Apr 2 0.03068761 15.00449 0.36481843 May 2 0.06075671 15.01412 -0.07487730 Jun 2 0.89308776 15.04210 -0.43518473 Jul 2 -0.55458236 15.07007 0.58450903 Aug 2 -2.78797194 15.13091 -0.64294084 Sep 2 1.07863881 15.19175 0.02960897 Oct 2 1.11384167 15.28759 0.29856944 Nov 2 0.54904531 15.38343 -0.93247088 Dec 2 -0.71954950 15.50371 0.11583688 Jan 3 -0.76991970 15.62400 -0.25407997 Feb 3 -0.55465121 15.76321 0.09143857 Mar 3 1.66061694 15.90243 0.33695744 Apr 3 0.03068761 16.05067 0.31864717 May 3 0.06075671 16.19890 -0.85966153 Jun 3 0.89308776 16.33690 0.67000789 Jul 3 -0.55458236 16.47490 -0.02032151 Aug 3 -2.78797194 16.59311 0.09485766 Sep 3 1.07863881 16.71132 0.01003650 Oct 3 1.11384167 16.81924 -0.03308194 Nov 3 0.54904531 16.92716 -0.07620117 Dec 3 -0.71954950 17.01712 0.40242683 Jan 4 -0.76991970 17.10709 -0.33716979 Feb 4 -0.55465121 17.18076 -0.02611032 Mar 4 1.66061694 17.25443 0.18494947 Apr 4 0.03068761 17.33091 0.43840531 May 4 0.06075671 17.40738 -0.26813730 Jun 4 0.89308776 17.50340 0.20351402 Jul 4 -0.55458236 17.59942 -0.74483347 Aug 4 -2.78797194 17.70800 0.17997068 Sep 4 1.07863881 17.81659 0.30477451 Oct 4 1.11384167 17.92246 -1.33630262 Nov 4 0.54904531 18.02834 0.52261948 Dec 4 -0.71954950 18.13746 0.58209310 Jan 5 -0.76991970 18.24658 0.02334212 Feb 5 -0.55465121 18.34245 0.01220281 Mar 5 1.66061694 18.43832 1.00106382 Apr 5 0.03068761 18.49038 -1.32106419 May 5 0.06075671 18.54243 0.79680935 Jun 5 0.89308776 18.58169 0.32522355 Jul 5 -0.55458236 18.62094 -0.46636106 Aug 5 -2.78797194 18.65503 0.33294458 Sep 5 1.07863881 18.68911 -0.26775010 Oct 5 1.11384167 18.71975 0.06640748 Nov 5 0.54904531 18.75039 0.70056428 Dec 5 -0.71954950 18.77878 -0.75923065 > m$win s t l 601 19 13 > m$deg s t l 0 1 1 > m$jump s t l 61 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/1l8bf1259957636.ps",horizontal=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/2duos1259957636.ps",horizontal=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/3qjhg1259957636.ps",horizontal=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/4f43k1259957636.ps",horizontal=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/5yuvs1259957636.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/6mdlx1259957636.tab") > system("convert tmp/1l8bf1259957636.ps tmp/1l8bf1259957636.png") > system("convert tmp/2duos1259957636.ps tmp/2duos1259957636.png") > system("convert tmp/3qjhg1259957636.ps tmp/3qjhg1259957636.png") > system("convert tmp/4f43k1259957636.ps tmp/4f43k1259957636.png") > > > proc.time() user system elapsed 0.952 0.607 1.141