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(112,118,132,129,121,135,148,148,136,119,104,118,115,126,141,135,125,149,170,170,158,133,114,140,145,150,178,163,172,178,199,199,184,162,146,166,171,180,193,181,183,218,230,242,209,191,172,194,196,196,236,235,229,243,264,272,237,211,180,201,204,188,235,227,234,264,302,293,259,229,203,229,242,233,267,269,270,315,364,347,312,274,237,278,284,277,317,313,318,374,413,405,355,306,271,306,315,301,356,348,355,422,465,467,404,347,305,336,340,318,362,348,363,435,491,505,404,359,310,337,360,342,406,396,420,472,548,559,463,407,362,405,417,391,419,461,472,535,622,606,508,461,390,432) > par5 = '12' > par4 = '0' > par3 = '1' > par2 = '-0.3' > 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/1plcz1228241461.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/26y8t1228241461.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.165842764 -0.133940569 -0.129332625 -0.322644421 [6] -0.073718953 0.073609411 -0.113316447 -0.341795739 -0.094669556 [11] -0.112903458 0.178548674 0.828454439 0.186414252 -0.155535324 [16] -0.087473839 -0.283857311 -0.037160376 0.046139623 -0.117549836 [21] -0.334201688 -0.087866716 -0.070137841 0.173617367 0.714818668 [26] 0.168221045 -0.130113281 -0.074009183 -0.209866257 -0.057491459 [31] 0.039902735 -0.120646153 -0.283839790 -0.111970926 -0.036131683 [36] 0.120704917 0.642717140 0.167828643 -0.139599727 -0.033231111 [41] -0.164819400 -0.056585259 0.024860081 -0.114440240 -0.282135858 [46] -0.085154665 -0.032181549 0.101368699 0.576023426 0.173262585 [51] -0.144722119 -0.028764207 -0.127237585 -0.028319788 0.020749309 [56] -0.099387825 -0.294914950 -0.077932225 -0.008891006 0.087948082 [61] 0.511937497 > (mypacf <- c(rpacf$acf)) [1] 0.165842764 -0.166010310 -0.080258819 -0.325886993 0.001528380 [6] -0.031034111 -0.219547987 -0.493195187 -0.185369907 -0.488799694 [11] -0.309754698 0.582115240 0.066907031 -0.143996331 0.135460371 [16] -0.007042110 0.036224915 -0.143624011 0.096261021 -0.010023995 [21] -0.055549367 -0.010405762 0.043744319 0.013102136 -0.044343684 [26] 0.056316309 0.045371709 0.055662190 -0.084789753 0.032971784 [31] 0.092012296 0.097790843 -0.080870011 0.055369648 -0.087377593 [36] 0.097624415 -0.016799569 -0.078705898 0.097048340 0.037415143 [41] -0.046227965 0.035921357 -0.004150420 -0.039537956 0.011075142 [46] 0.007962607 0.026284259 0.060719960 -0.029966878 0.062557043 [51] -0.094310623 0.032234233 0.101745952 -0.023180134 0.080633326 [56] -0.014752912 0.033472899 0.056955843 0.047793956 -0.001457059 > 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/3gq6e1228241461.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/4apw61228241461.tab") > > system("convert tmp/1plcz1228241461.ps tmp/1plcz1228241461.png") > system("convert tmp/26y8t1228241461.ps tmp/26y8t1228241461.png") > > > proc.time() user system elapsed 0.603 0.301 0.852