#A function for doing multiple Box-Ljeung Tests. #This assumes that x is a time series and k is an integer BLpvalue<-function(x,k){ return(autocorTest(x,lag.n=k)$p.value)} #Example using Microsoft returns. The vector pv gets the pvalues #for all lags from 1 to the default value (n*log n) for this particular series. msft.p<-singleIndex.dat@data[,"MSFT"] msft.r<-getReturns(msft.p) pv<-rep(0,21) for(k in 1:21){pv[k]<-BLpvalue(msft.r,k)}