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(7.1,6.9,6.8,7.5,7.6,7.8,8.0,8.1,8.2,8.3,8.2,8.0,7.9,7.6,7.6,8.3,8.4,8.4,8.4,8.4,8.6,8.9,8.8,8.3,7.5,7.2,7.4,8.8,9.3,9.3,8.7,8.2,8.3,8.5,8.6,8.5,8.2,8.1,7.9,8.6,8.7,8.7,8.5,8.4,8.5,8.7,8.7,8.6,8.5,8.3,8.0,8.2,8.1,8.1,8.0,7.9,7.9,8.0,8.0,7.9,8.0,7.7,7.2,7.5,7.3,7.0,7.0,7.0,7.2,7.3,7.1,6.8,6.4,6.1,6.5,7.7,7.9,7.5,6.9,6.6,6.9,7.7,8.0,8.0,7.7,7.3,7.4,8.1,8.3,8.2) > 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.20271926 7.262029 0.040690636 Feb 1 -0.47625389 7.343976 0.032277503 Mar 1 -0.53728875 7.425924 -0.088635405 Apr 1 0.18736551 7.503864 -0.191229395 May 1 0.28701979 7.581804 -0.268823409 Jun 1 0.19666474 7.654924 -0.051589191 Jul 1 0.02383561 7.728045 0.248119103 Aug 1 -0.11107167 7.800595 0.410476460 Sep 1 0.02544962 7.873145 0.301405250 Oct 1 0.27269313 7.939603 0.087704118 Nov 1 0.26279388 8.006060 -0.068854244 Dec 1 0.07151134 8.046008 -0.117519748 Jan 2 -0.20271926 8.085956 0.016762803 Feb 2 -0.47625389 8.119547 -0.043293436 Mar 2 -0.53728875 8.153138 -0.015849450 Apr 2 0.18736551 8.195587 -0.082952756 May 2 0.28701979 8.238036 -0.125056089 Jun 2 0.19666474 8.261557 -0.058222109 Jul 2 0.02383561 8.285078 0.091085947 Aug 2 -0.11107167 8.280573 0.230498853 Sep 2 0.02544962 8.276067 0.298483191 Oct 2 0.27269313 8.287885 0.339421686 Nov 2 0.26279388 8.299703 0.237502951 Dec 2 0.07151134 8.329915 -0.101426404 Jan 3 -0.20271926 8.360127 -0.657407706 Feb 3 -0.47625389 8.371411 -0.695157284 Mar 3 -0.53728875 8.382695 -0.445406638 Apr 3 0.18736551 8.384978 0.227655994 May 3 0.28701979 8.387262 0.625718602 Jun 3 0.19666474 8.411121 0.692214547 Jul 3 0.02383561 8.434980 0.241184569 Aug 3 -0.11107167 8.460246 -0.149174299 Sep 3 0.02544962 8.485512 -0.210961735 Oct 3 0.27269313 8.474097 -0.246790396 Nov 3 0.26279388 8.462682 -0.125476286 Dec 3 0.07151134 8.442078 -0.013589747 Jan 4 -0.20271926 8.421474 -0.018755154 Feb 4 -0.47625389 8.425850 0.150404381 Mar 4 -0.53728875 8.430225 0.007064139 Apr 4 0.18736551 8.442688 -0.030053174 May 4 0.28701979 8.455151 -0.042170513 Jun 4 0.19666474 8.466385 0.036950091 Jul 4 0.02383561 8.477620 -0.001455228 Aug 4 -0.11107167 8.487008 0.024063515 Sep 4 0.02544962 8.496397 -0.021846309 Oct 4 0.27269313 8.482328 -0.055020719 Nov 4 0.26279388 8.468258 -0.031052358 Dec 4 0.07151134 8.427759 0.100729773 Jan 5 -0.20271926 8.387259 0.315459958 Feb 5 -0.47625389 8.334449 0.441804831 Mar 5 -0.53728875 8.281639 0.255649928 Apr 5 0.18736551 8.219043 -0.206408216 May 5 0.28701979 8.156447 -0.343466385 Jun 5 0.19666474 8.094232 -0.190897162 Jul 5 0.02383561 8.032018 -0.055853863 Aug 5 -0.11107167 7.983266 0.027805886 Sep 5 0.02544962 7.934513 -0.059962933 Oct 5 0.27269313 7.884475 -0.157168565 Nov 5 0.26279388 7.834438 -0.097231427 Dec 5 0.07151134 7.762867 0.065622030 Jan 6 -0.20271926 7.691296 0.511423541 Feb 6 -0.47625389 7.610649 0.565604848 Mar 6 -0.53728875 7.530002 0.207286381 Apr 6 0.18736551 7.446513 -0.133878317 May 6 0.28701979 7.363023 -0.350043040 Jun 6 0.19666474 7.262538 -0.459202601 Jul 6 0.02383561 7.162052 -0.185888085 Aug 6 -0.11107167 7.077539 0.033532504 Sep 6 0.02544962 6.993026 0.181524527 Oct 6 0.27269313 6.978030 0.049277352 Nov 6 0.26279388 6.963033 -0.125827052 Dec 6 0.07151134 6.980461 -0.251972692 Jan 7 -0.20271926 6.997890 -0.395170277 Feb 7 -0.47625389 7.004340 -0.428086120 Mar 7 -0.53728875 7.010790 0.026498261 Apr 7 0.18736551 7.042255 0.470379660 May 7 0.28701979 7.073719 0.539261034 Jun 7 0.19666474 7.149581 0.153753923 Jul 7 0.02383561 7.225444 -0.349279111 Aug 7 -0.11107167 7.305607 -0.594535734 Sep 7 0.02544962 7.385771 -0.511220924 Oct 7 0.27269313 7.462891 -0.035584408 Nov 7 0.26279388 7.540011 0.197194879 Dec 7 0.07151134 7.619574 0.308914689 Jan 8 -0.20271926 7.699137 0.203582553 Feb 8 -0.47625389 7.783448 -0.007193910 Mar 8 -0.53728875 7.867759 0.069529852 Apr 8 0.18736551 7.953826 -0.041191170 May 8 0.28701979 8.039892 -0.026912219 Jun 8 0.19666474 8.125752 -0.122417089 > m$win s t l 901 19 13 > m$deg s t l 0 1 1 > m$jump s t l 91 2 2 > m$inner [1] 2 > m$outer [1] 0 > postscript(file="/var/www/html/rcomp/tmp/11ocv1259936054.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/2agz91259936054.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/3r11o1259936054.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/41v901259936054.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/5x8081259936054.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/612nn1259936054.tab") > system("convert tmp/11ocv1259936054.ps tmp/11ocv1259936054.png") > system("convert tmp/2agz91259936054.ps tmp/2agz91259936054.png") > system("convert tmp/3r11o1259936054.ps tmp/3r11o1259936054.png") > system("convert tmp/41v901259936054.ps tmp/41v901259936054.png") > > > proc.time() user system elapsed 1.136 0.636 5.073