R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(508643,527568,520008,498484,523917,553522,558901,548933,567013,551085,588245,605010,631572,639180,653847,657073,626291,625616,633352,672820,691369,702595,692241,718722,732297,721798,766192,788456,806132,813944,788025,765985,702684,730159,678942,672527,594783,594575,576299,530770,524491,456590,428448,444937,372206,317272,297604,288561,289287,258923,255493,277992,295474,291680,318736,338463,351963,347240,347081,383486) > 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 -1583.8138 496313.2 13913.64455 Feb 1 -2637.3909 505397.6 24807.75415 Mar 1 5175.6448 514482.1 350.25095 Apr 1 1945.7062 523861.1 -27322.77608 May 1 7234.5561 533240.0 -16557.59163 Jun 1 1856.5800 542785.4 8880.01078 Jul 1 691.1996 552330.8 5879.01744 Aug 1 11839.7927 562038.1 -24944.85393 Sep 1 -2927.4450 571745.3 -1804.89442 Oct 1 -7896.7708 582210.9 -23229.08799 Nov 1 -14336.9304 592676.4 9905.55229 Dec 1 638.8990 601605.0 2766.11276 Jan 2 -1583.8138 610533.6 22622.21531 Feb 2 -2637.3909 619194.6 22622.75081 Mar 2 5175.6448 627855.7 20815.67352 Apr 2 1945.7062 637086.6 18040.68925 May 2 7234.5561 646317.5 -27261.08354 Jun 2 1856.5800 655086.3 -31326.84195 Jul 2 691.1996 663855.0 -31194.19612 Aug 2 11839.7927 673105.9 -12125.71319 Sep 2 -2927.4450 682356.8 11939.60062 Oct 2 -7896.7708 694418.9 16072.89015 Nov 2 -14336.9304 706480.9 97.01353 Dec 2 638.8990 719670.7 -1587.57297 Jan 3 -1583.8138 732860.4 1020.38260 Feb 3 -2637.3909 741496.3 -17060.88554 Mar 3 5175.6448 750132.1 10884.23352 Apr 3 1945.7062 752273.7 34236.61154 May 3 7234.5561 754415.2 44482.20104 Jun 3 1856.5800 749494.9 62592.47502 Jul 3 691.1996 744574.6 42759.15325 Aug 3 11839.7927 731322.4 22822.79640 Sep 3 -2927.4450 718070.2 -12458.72956 Oct 3 -7896.7708 696621.0 41434.77035 Nov 3 -14336.9304 675171.8 18107.10411 Dec 3 638.8990 648190.9 23697.16076 Jan 4 -1583.8138 621210.1 -24843.24050 Feb 4 -2637.3909 591876.9 5335.47669 Mar 4 5175.6448 562543.8 8579.58109 Apr 4 1945.7062 531710.6 -2886.33173 May 4 7234.5561 500877.5 16378.96692 Jun 4 1856.5800 470520.3 -15786.88100 Jul 4 691.1996 440163.1 -12406.32467 Aug 4 11839.7927 412654.9 20442.32535 Sep 4 -2927.4450 385146.6 -10013.19375 Oct 4 -7896.7708 362674.4 -37505.65214 Nov 4 -14336.9304 340202.2 -28261.27668 Dec 4 638.8990 325288.8 -37366.71315 Jan 5 -1583.8138 310375.4 -19504.60755 Feb 5 -2637.3909 304158.4 -42598.00985 Mar 5 5175.6448 297941.4 -47624.02496 Apr 5 1945.7062 303633.0 -27586.72630 May 5 7234.5561 309324.7 -21085.21617 Jun 5 1856.5800 315815.2 -25991.75095 Jul 5 691.1996 322305.7 -4260.88148 Aug 5 11839.7927 329698.3 -3075.05111 Sep 5 -2927.4450 337090.8 17799.61014 Oct 5 -7896.7708 345426.8 9709.94218 Nov 5 -14336.9304 353762.8 7655.10807 Dec 5 638.8990 362717.2 20129.89461 > 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/rcomp/tmp/1aik31293388760.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/rcomp/tmp/2krj51293388760.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/rcomp/tmp/3krj51293388760.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/rcomp/tmp/4oa0t1293388760.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/59syz1293388760.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/rcomp/tmp/6n2w81293388760.tab") > > try(system("convert tmp/1aik31293388760.ps tmp/1aik31293388760.png",intern=TRUE)) character(0) > try(system("convert tmp/2krj51293388760.ps tmp/2krj51293388760.png",intern=TRUE)) character(0) > try(system("convert tmp/3krj51293388760.ps tmp/3krj51293388760.png",intern=TRUE)) character(0) > try(system("convert tmp/4oa0t1293388760.ps tmp/4oa0t1293388760.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.120 0.410 1.514