R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(132.7,128.6,127.8,128.9,124.6,129.2,130.5,124.3,125.8,123.5,120.7,123.1,122.0,121.0,121.2,117.4,113.0,113.1,116.1,121.3,108.6,114.3,113.5,111.2,109.3,108.2,102.7,110.4,108.1,112.8,108.1,102.6,109.2,108.2,107.1,108.4,103.6,104.0,111.5,105.4,105.5,101.3,103.8,100.3,108.2,105.6,103.0,100.5,104.3,99.1,91.5) > par5 = '12' > par4 = '0' > par3 = '0' > par2 = '0.2' > 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 (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/1mp0b1228657150.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > racf <- acf(x,par1,main='Autocorrelation',xlab='lags',ylab='ACF') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2flcc1228657150.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.804471385 0.738242262 0.710095912 0.651318525 [6] 0.619479684 0.583963316 0.510264810 0.464969577 0.406950722 [11] 0.363429982 0.313817277 0.218690960 0.225650310 0.164596925 [16] 0.111697371 0.092372872 0.044964808 0.005147332 0.011900258 [21] -0.091768808 -0.093305420 -0.123905314 -0.145988452 -0.156186896 [26] -0.206513196 -0.221940219 -0.220349834 -0.274874125 -0.263034263 [31] -0.281804077 -0.340031071 -0.288448277 -0.293476555 -0.319412295 [36] -0.344581455 -0.362314555 -0.344750647 -0.326852603 -0.336179545 [41] -0.326293909 -0.331575026 -0.303266525 -0.281577724 -0.259583174 [46] -0.235523794 -0.206651989 -0.194239236 -0.148270077 -0.128926212 [51] -0.090399015 > (mypacf <- c(rpacf$acf)) [1] 0.8044713849 0.2581105333 0.1878084068 0.0095986310 0.0576787324 [6] 0.0141430599 -0.1091709987 -0.0306818379 -0.0730986364 -0.0046373772 [11] -0.0480404956 -0.1772684902 0.1608643976 -0.0927757164 -0.0185238131 [16] 0.0107317470 -0.0301479418 -0.0093111172 0.0609698982 -0.2513566709 [21] 0.0990464841 -0.0703310759 0.0490924938 -0.0496124719 -0.0664039481 [26] 0.0141142662 0.0167877455 -0.1351209298 0.0773593612 -0.0871690397 [31] -0.0619450066 0.0682963107 0.0568227907 -0.1076698712 -0.1104253351 [36] -0.0472385860 0.0699545435 -0.0013889958 0.0355430806 -0.1383924187 [41] 0.1009374564 -0.0021718397 -0.0370605706 0.1398289318 -0.0498077176 [46] 0.0002618076 0.0326925545 -0.0424272521 0.0768415529 0.0493430855 > 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/3fn7t1228657150.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/4sse61228657150.tab") > > system("convert tmp/1mp0b1228657150.ps tmp/1mp0b1228657150.png") > system("convert tmp/2flcc1228657150.ps tmp/2flcc1228657150.png") > > > proc.time() user system elapsed 0.596 0.318 0.709