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(0.6348,0.634,0.62915,0.62168,0.61328,0.6089,0.60857,0.62672,0.62291,0.62393,0.61838,0.62012,0.61659,0.6116,0.61573,0.61407,0.62823,0.64405,0.6387,0.63633,0.63059,0.62994,0.63709,0.64217,0.65711,0.66977,0.68255,0.68902,0.71322,0.70224,0.70045,0.69919,0.69693,0.69763,0.69278,0.70196,0.69215,0.6769,0.67124,0.66532,0.67157,0.66428,0.66576,0.66942,0.6813,0.69144,0.69862,0.695,0.69867,0.68968,0.69233,0.68293,0.68399,0.66895,0.68756,0.68527,0.6776,0.68137,0.67933,0.67922) > 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.0025799851 0.6287099 3.510099e-03 Feb 1 -0.0017251989 0.6273729 8.352345e-03 Mar 1 -0.0007463824 0.6260358 3.860590e-03 Apr 1 -0.0049454456 0.6248171 1.808369e-03 May 1 0.0019054970 0.6235984 -1.222386e-02 Jun 1 -0.0030766081 0.6224026 -1.042597e-02 Jul 1 -0.0011607222 0.6212068 -1.147608e-02 Aug 1 0.0014736812 0.6199878 5.258493e-03 Sep 1 -0.0005899079 0.6187689 4.731056e-03 Oct 1 0.0017474695 0.6185137 3.668794e-03 Nov 1 0.0014668494 0.6182586 -1.345471e-03 Dec 1 0.0030707860 0.6195802 -2.531012e-03 Jan 2 0.0025799851 0.6209018 -6.891816e-03 Feb 2 -0.0017251989 0.6223922 -9.066955e-03 Mar 2 -0.0007463824 0.6238825 -7.406095e-03 Apr 2 -0.0049454456 0.6253461 -6.330637e-03 May 2 0.0019054970 0.6268097 -4.851844e-04 Jun 2 -0.0030766081 0.6291674 1.795917e-02 Jul 2 -0.0011607222 0.6315252 8.335538e-03 Aug 2 0.0014736812 0.6354867 -6.303391e-04 Sep 2 -0.0005899079 0.6394481 -8.268224e-03 Oct 2 0.0017474695 0.6448705 -1.667800e-02 Nov 2 0.0014668494 0.6502929 -1.466978e-02 Dec 2 0.0030707860 0.6563882 -1.728898e-02 Jan 3 0.0025799851 0.6624835 -7.953437e-03 Feb 3 -0.0017251989 0.6687352 2.759963e-03 Mar 3 -0.0007463824 0.6749870 8.309362e-03 Apr 3 -0.0049454456 0.6806164 1.334904e-02 May 3 0.0019054970 0.6862458 2.506870e-02 Jun 3 -0.0030766081 0.6899479 1.536875e-02 Jul 3 -0.0011607222 0.6936499 7.960799e-03 Aug 3 0.0014736812 0.6942762 3.440163e-03 Sep 3 -0.0005899079 0.6949024 2.617521e-03 Oct 3 0.0017474695 0.6928845 2.997998e-03 Nov 3 0.0014668494 0.6908667 4.464731e-04 Dec 3 0.0030707860 0.6878266 1.106261e-02 Jan 4 0.0025799851 0.6847865 4.783491e-03 Feb 4 -0.0017251989 0.6823189 -3.693721e-03 Mar 4 -0.0007463824 0.6798513 -7.864933e-03 Apr 4 -0.0049454456 0.6787193 -8.453822e-03 May 4 0.0019054970 0.6775872 -7.922716e-03 Jun 4 -0.0030766081 0.6778882 -1.053155e-02 Jul 4 -0.0011607222 0.6781891 -1.126838e-02 Aug 4 0.0014736812 0.6796321 -1.168578e-02 Sep 4 -0.0005899079 0.6810751 8.148167e-04 Oct 4 0.0017474695 0.6828084 6.884082e-03 Nov 4 0.0014668494 0.6845418 1.261135e-02 Dec 4 0.0030707860 0.6857628 6.166418e-03 Jan 5 0.0025799851 0.6869838 9.106229e-03 Feb 5 -0.0017251989 0.6872599 4.145311e-03 Mar 5 -0.0007463824 0.6875360 5.540393e-03 Apr 5 -0.0049454456 0.6864130 1.462426e-03 May 5 0.0019054970 0.6852900 -3.205546e-03 Jun 5 -0.0030766081 0.6840426 -1.201597e-02 Jul 5 -0.0011607222 0.6827951 5.925624e-03 Aug 5 0.0014736812 0.6814857 2.310640e-03 Sep 5 -0.0005899079 0.6801763 -1.986351e-03 Oct 5 0.0017474695 0.6788482 7.743187e-04 Nov 5 0.0014668494 0.6775202 3.429855e-04 Dec 5 0.0030707860 0.6761908 -4.162129e-05 > 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/1iu8m1259927589.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/2zk7s1259927589.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/32vp11259927589.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/4v8ph1259927589.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/56i0m1259927590.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/6uc671259927590.tab") > system("convert tmp/1iu8m1259927589.ps tmp/1iu8m1259927589.png") > system("convert tmp/2zk7s1259927589.ps tmp/2zk7s1259927589.png") > system("convert tmp/32vp11259927589.ps tmp/32vp11259927589.png") > system("convert tmp/4v8ph1259927589.ps tmp/4v8ph1259927589.png") > > > proc.time() user system elapsed 0.947 0.606 1.118