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(67.8,66.9,71.5,75.9,71.9,70.7,73.5,76.1,82.5,87.1,83.2,86.1,85.9,77.4,74.4,69.9,73.8,69.2,69.7,71,71.2,75.8,73,66.4,58.6,55.5,52.6,54.9,54.6,51.2,50.9,49.6,53.4,52,47.5,42.1,44.5,43.2,51.4,59.4,60.3,61.4,68.8,73.6,81.8,79.6,85.8,88.1,89.1,95,96.2,84.2,96.9,103.1,99.3,103.5,112.4,111.1,113.7,92,93,98.4,92.6,94.6,99.5,97.6,91.3,93.6,93.1,78.4,70.2,69.3,71.1,73.5,85.9,91.5,91.8,88.3,91.3,94,99.3,96.7,88,96.7,106.8,114.3,105.7,90.1,91.6,97.7,100.8,104.6,95.9,102.7,104,107.9,113.8,113.8,123.1,125.1,137.6,134,140.3,152.1,150.6,167.3,153.2,142,154.4,158.5,180.9,181.3,172.4,192,199.3,215.4,214.3,201.5,190.5,196,215.7,209.4,214.1,237.8,239,237.8,251.5,248.8,215.4,201.2,203.1,214.2,188.9,203,213.3,228.5,228.2,240.9,258.8,248.5,269.2,289.6,323.4,317.2,322.8,340.9,368.2,388.5,441.2,474.3,483.9,417.9,365.9,263,199.4) > par5 = '12' > par4 = '0' > par3 = '2' > par2 = '-0.1' > par1 = '36' > 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/1vvyf1229875504.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/24kt41229875504.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.372854186 -0.112030408 0.018984158 -0.040082875 [6] 0.070131715 0.008938509 -0.039906464 0.008742291 -0.141649988 [11] 0.125624323 0.123768327 -0.010031663 -0.181875065 0.089619743 [16] -0.003877112 -0.049769328 0.049826017 -0.020024579 -0.019529227 [21] 0.067130970 -0.137920666 0.182533739 -0.137393008 -0.055076740 [26] 0.204627330 -0.081436462 -0.067372096 0.094183233 -0.102319251 [31] 0.072183678 0.012945949 -0.044362169 0.017323923 -0.128645227 [36] 0.097037696 0.100088946 > (mypacf <- c(rpacf$acf)) [1] -0.372854186 -0.291587172 -0.182394647 -0.184414732 -0.060300813 [6] -0.013977556 -0.031276651 -0.014913168 -0.203048336 -0.066134480 [11] 0.110096733 0.176997920 -0.058175370 0.036444038 0.002923439 [16] -0.095492248 -0.054419586 -0.041665008 -0.012548878 0.093876944 [21] -0.126377101 0.016051267 -0.108492371 -0.141258490 0.102537865 [26] 0.075291273 0.009452481 0.092689339 -0.060279510 -0.049100984 [31] 0.028821519 -0.013196224 0.032804537 -0.141400093 -0.032439850 [36] -0.010290106 > 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/3dpla1229875504.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/4bs2z1229875504.tab") > > system("convert tmp/1vvyf1229875504.ps tmp/1vvyf1229875504.png") > system("convert tmp/24kt41229875504.ps tmp/24kt41229875504.png") > > > proc.time() user system elapsed 0.528 0.314 0.754