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(79.8,83.4,113.6,112.9,104,109.9,99,106.3,128.9,111.1,102.9,130,87,87.5,117.6,103.4,110.8,112.6,102.5,112.4,135.6,105.1,127.7,137,91,90.5,122.4,123.3,124.3,120,118.1,119,142.7,123.6,129.6,151.6,110.4,99.2,130.5,136.2,129.7,128,121.6,135.8,143.8,147.5,136.2,156.6,123.3,104.5,139.8,136.5,112.1,118.5,94.4,102.3,111.4,99.2,87.8,115.8) > par7 = '0.95' > par6 = 'White Noise' > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '1' > par1 = '60' > 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 (par2 == 0) { + x <- log(x) + } else { + x <- (x ^ par2 - 1) / par2 + } > if (par3 > 0) x <- diff(x,lag=1,difference=par3) > if (par4 > 0) x <- diff(x,lag=par5,difference=par4) > postscript(file="/var/www/html/rcomp/tmp/1vnah1259778449.ps",horizontal=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=paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='')) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2e58v1259778449.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF') > dev.off() null device 1 > (myacf <- c(racf$acf)) [1] 1.000000000 0.387766958 0.117697068 0.402150850 0.193957458 [6] 0.170786948 0.351239823 0.024764943 0.006117678 0.171174828 [11] -0.126376486 0.003641334 0.442677495 0.060681838 -0.167090932 [16] 0.088876470 -0.028070844 -0.061390357 0.084296246 -0.113003808 [21] -0.162646753 -0.010419762 -0.252337517 -0.179517935 0.170058412 [26] -0.039296337 -0.286355334 -0.085201806 -0.125288766 -0.173228025 [31] -0.050435801 -0.146778546 -0.222260649 -0.080368696 -0.205773888 [36] -0.236708842 0.035697121 -0.045397468 -0.211276668 -0.061448574 [41] -0.074515422 -0.094400902 0.011162124 -0.077691045 -0.114966494 [46] -0.032534001 -0.099401772 -0.108444123 0.054141003 0.001300086 [51] -0.064251474 0.016432543 0.049417294 0.061982586 0.093100429 [56] 0.046554435 0.046005035 0.085455252 0.058100060 0.001642711 > (mypacf <- c(rpacf$acf)) [1] 0.387766958 -0.038447189 0.435730801 -0.172415018 0.274083548 [6] 0.052478689 -0.221567689 0.094544226 -0.120663048 -0.173508615 [11] 0.225759859 0.407248811 -0.220116854 -0.167244353 -0.064698064 [16] -0.031011705 -0.118646458 -0.063987113 0.166139518 -0.092220537 [21] -0.009037002 -0.110387116 0.094576897 -0.066435594 0.052777040 [26] -0.151324908 0.004611728 -0.101443652 -0.041181000 -0.029577868 [31] 0.047273192 -0.030709017 -0.001469969 0.055992611 -0.141333476 [36] -0.047327438 -0.070495015 0.188392947 -0.087593989 -0.026700342 [41] 0.130527302 -0.099613705 -0.107249043 -0.043779252 0.016310500 [46] -0.031295351 0.084410879 -0.031122336 0.017449899 -0.024170884 [51] 0.025832000 0.089499593 -0.024242408 -0.030978355 -0.012020752 [56] 0.005755961 -0.013411135 0.005406000 -0.114785868 > lengthx <- length(x) > sqrtn <- sqrt(lengthx) > > #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,'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/html/rcomp/tmp/3ay131259778449.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/html/rcomp/tmp/4my351259778449.tab") > > system("convert tmp/1vnah1259778449.ps tmp/1vnah1259778449.png") > system("convert tmp/2e58v1259778449.ps tmp/2e58v1259778449.png") > > > proc.time() user system elapsed 0.602 0.316 0.699