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(369.82,373.10,374.55,375.01,374.81,375.31,375.31,375.39,375.59,376.26,377.18,377.26,377.26,381.87,387.09,387.14,388.78,389.16,389.16,389.42,389.49,388.97,388.97,389.09,389.09,391.76,390.96,391.76,392.80,393.06,393.06,393.26,393.87,394.47,394.57,394.57,394.57,399.57,406.13,407.03,409.46,409.90,409.90,410.14,410.54,410.69,410.79,410.97,410.97,413.80,423.31,423.85,426.60,426.26,426.26,426.32,427.14,427.55,428.29,428.80) > par8 = '' > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '1' > par1 = '48' > if (par1 == 'Default') { + par1 = 10*log10(length(x)) + } else { + par1 <- as.numeric(par1) + } > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > par4 <- as.numeric(par4) > par5 <- as.numeric(par5) > if (par6 == 'White Noise') par6 <- 'white' else par6 <- 'ma' > par7 <- as.numeric(par7) > if (par8 != '') par8 <- as.numeric(par8) > ox <- x > if (par8 == '') { + if (par2 == 0) { + x <- log(x) + } else { + x <- (x ^ par2 - 1) / par2 + } + } else { + x <- log(x,base=par8) + } > if (par3 > 0) x <- diff(x,lag=1,difference=par3) > if (par4 > 0) x <- diff(x,lag=par5,difference=par4) > postscript(file="/var/www/rcomp/tmp/1za4l1321459232.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > op <- par(mfrow=c(2,1)) > plot(ox,type='l',main='Original Time Series',xlab='time',ylab='value') > if (par8=='') { + mytitle <- paste('Working Time Series (lambda=',par2,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } else { + mytitle <- paste('Working Time Series (base=',par8,', d=',par3,', D=',par4,')',sep='') + mysub <- paste('(base=',par8,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='') + } > plot(x,type='l', main=mytitle,xlab='time',ylab='value') > par(op) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/2m5o31321459232.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > racf <- acf(x, par1, main='Autocorrelation', xlab='time lag', ylab='ACF', ci.type=par6, ci=par7, sub=mysub) > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/3dkjo1321459232.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF',sub=mysub) > dev.off() null device 1 > (myacf <- c(racf$acf)) [1] 1.000000000 0.246673158 0.038875146 -0.069921334 -0.167638727 [6] -0.169929415 -0.128629087 -0.189790427 -0.167795830 -0.086415026 [11] -0.028079881 0.066256568 0.409388712 0.247704235 -0.012486611 [16] -0.016000582 -0.149304679 -0.133351503 -0.075123104 -0.091133429 [21] -0.108595466 -0.068303834 -0.014433515 0.060911261 0.221634092 [26] 0.173893302 -0.037835581 0.018245045 -0.080892424 -0.117841752 [31] -0.091250979 -0.088886142 -0.102737737 -0.071178670 -0.055150661 [36] -0.004417306 0.312740624 0.218144744 0.015417935 0.011289478 [41] -0.037892241 -0.053336624 -0.043537161 -0.054139062 -0.061143301 [46] -0.050990088 -0.067869053 -0.012565475 0.047227475 > (mypacf <- c(rpacf$acf)) [1] 0.2466731583 -0.0233960989 -0.0787992096 -0.1399454706 -0.1025937307 [6] -0.0719118896 -0.1772471173 -0.1452054795 -0.0886470340 -0.0799830376 [11] -0.0218000835 0.3378847200 0.0416477989 -0.1644764798 0.0075527278 [16] -0.0939375800 -0.0376444988 -0.0138003563 0.0002815112 -0.0329422024 [21] -0.0553467215 -0.0076362119 0.0219362539 0.0131440660 -0.0409805728 [26] -0.0934333562 0.0518169927 -0.0358012793 -0.0452142377 -0.0717872243 [31] -0.0527303247 -0.0681907679 -0.0684791544 -0.0854748518 -0.0917762570 [36] 0.2271993848 -0.0141609702 -0.0810647953 -0.0160394753 -0.0266382903 [41] 0.0347672526 -0.0281480399 0.0346388782 0.0341102295 -0.0058843438 [46] -0.0438709632 0.0436551756 -0.2037379492 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #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,'Autocorrelation Function',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Time lag k',header=TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/basics.htm','ACF(k)','click here for more information about the Autocorrelation Function'),header=TRUE) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,'P-value',header=TRUE) > a<-table.row.end(a) > for (i in 2:(par1+1)) { + a<-table.row.start(a) + a<-table.element(a,i-1,header=TRUE) + a<-table.element(a,round(myacf[i],6)) + mytstat <- myacf[i]*sqrtn + a<-table.element(a,round(mytstat,4)) + a<-table.element(a,round(1-pt(abs(mytstat),lengthx),6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/4cqar1321459232.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Partial Autocorrelation Function',4,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Time lag k',header=TRUE) > a<-table.element(a,hyperlink('http://www.xycoon.com/basics.htm','PACF(k)','click here for more information about the Partial Autocorrelation Function'),header=TRUE) > a<-table.element(a,'T-STAT',header=TRUE) > a<-table.element(a,'P-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:par1) { + a<-table.row.start(a) + a<-table.element(a,i,header=TRUE) + a<-table.element(a,round(mypacf[i],6)) + mytstat <- mypacf[i]*sqrtn + a<-table.element(a,round(mytstat,4)) + a<-table.element(a,round(1-pt(abs(mytstat),lengthx),6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/56djx1321459232.tab") > > try(system("convert tmp/1za4l1321459232.ps tmp/1za4l1321459232.png",intern=TRUE)) character(0) > try(system("convert tmp/2m5o31321459232.ps tmp/2m5o31321459232.png",intern=TRUE)) character(0) > try(system("convert tmp/3dkjo1321459232.ps tmp/3dkjo1321459232.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.50 0.06 1.55