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(1203,1319,1328,1260,1286,1274,1389,1255,1244,1336,1214,1239,1174,1061,1116,1123,1086,1074,965,1035,1016,941,1003,998,891,828,833,887,842,793,778,699,686,727,641,619,627,593,535,536,504,487,477,435,433,393,389,377,339,370,350,341,367,396,408,405,391,396,368,356) > 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 -19.9987559 1310.1972 -87.1984262 Feb 1 -16.2752293 1304.0048 31.2704119 Mar 1 -1.7516248 1297.8125 31.9391721 Apr 1 8.8572224 1290.5609 -39.4181423 May 1 10.0660000 1283.3094 -7.3753869 Jun 1 9.7176899 1274.9492 -10.6669169 Jul 1 20.1693481 1266.5891 102.2415847 Aug 1 -6.1104845 1257.2314 3.8790998 Sep 1 -6.5903354 1247.8737 2.7166334 Oct 1 11.8057010 1233.3152 90.8791036 Nov 1 -9.9982086 1218.7567 5.2415197 Dec 1 0.1086388 1197.0582 41.8331881 Jan 2 -19.9987559 1175.3597 18.6390987 Feb 2 -16.2752293 1150.5560 -73.2807343 Mar 2 -1.7516248 1125.7523 -8.0006451 Apr 2 8.8572224 1101.9816 12.1611990 May 2 10.0660000 1078.2109 -2.2768871 Jun 2 9.7176899 1057.1705 7.1117924 Jul 2 20.1693481 1036.1301 -91.2994964 Aug 2 -6.1104845 1015.7454 25.3650521 Sep 2 -6.5903354 995.3607 27.2296190 Oct 2 11.8057010 974.7859 -45.5915968 Nov 2 -9.9982086 954.2111 58.7871335 Dec 2 0.1086388 932.9485 64.9428805 Jan 3 -19.9987559 911.6859 -0.6871304 Feb 3 -16.2752293 887.9673 -43.6920269 Mar 3 -1.7516248 864.2486 -29.4970013 Apr 3 8.8572224 838.0873 40.0554761 May 3 10.0660000 811.9260 20.0080231 Jun 3 9.7176899 786.1963 -2.9139870 Jul 3 20.1693481 760.4666 -2.6359655 Aug 3 -6.1104845 735.9409 -30.8303690 Sep 3 -6.5903354 711.4151 -18.8247541 Oct 3 11.8057010 685.7449 29.4493855 Nov 3 -9.9982086 660.0747 -9.0765289 Dec 3 0.1086388 634.4242 -15.5328676 Jan 4 -19.9987559 608.7737 38.2250358 Feb 4 -16.2752293 584.5646 24.7106736 Mar 4 -1.7516248 560.3554 -23.6037665 Apr 4 8.8572224 536.6758 -9.5330317 May 4 10.0660000 512.9962 -19.0622273 Jun 4 9.7176899 490.9284 -13.6460749 Jul 4 20.1693481 468.8605 -12.0298910 Aug 4 -6.1104845 450.0853 -8.9748555 Sep 4 -6.5903354 431.3101 8.2801983 Oct 4 11.8057010 417.0987 -35.9044045 Nov 4 -9.9982086 402.8873 -3.8890612 Dec 4 0.1086388 393.8259 -16.9345231 Jan 5 -19.9987559 384.7645 -25.7657429 Feb 5 -16.2752293 380.8385 5.4367311 Mar 5 -1.7516248 376.9125 -25.1608727 Apr 5 8.8572224 377.2521 -45.1093342 May 5 10.0660000 377.5917 -20.6577260 Jun 5 9.7176899 377.4467 8.8356234 Jul 5 20.1693481 377.3016 10.5290045 Aug 5 -6.1104845 377.6494 33.4610619 Sep 5 -6.5903354 377.9972 19.5931378 Oct 5 11.8057010 378.7309 5.4633889 Nov 5 -9.9982086 379.4646 -1.4664140 Dec 5 0.1086388 380.2857 -24.3943157 > 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/1g9p61293577144.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/2g9p61293577144.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/38i691293577144.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/48i691293577144.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/55amz1293577144.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/6qa2n1293577144.tab") > > try(system("convert tmp/1g9p61293577144.ps tmp/1g9p61293577144.png",intern=TRUE)) character(0) > try(system("convert tmp/2g9p61293577144.ps tmp/2g9p61293577144.png",intern=TRUE)) character(0) > try(system("convert tmp/38i691293577144.ps tmp/38i691293577144.png",intern=TRUE)) character(0) > try(system("convert tmp/48i691293577144.ps tmp/48i691293577144.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.959 0.621 2.175