Hello,
I wrote a function to calculate the variance ratios like Lo and MacKinlay
(1988):
> vari <- function(indice,n,q){
+ y <- rep(0,q)
+ indice.reg <- lm(indice[2:n]~-1+indice[1:(n-1)])
+ a <- as.vector(acf(indice,q,plot=F)$acf)
+ b <- 1+2*(
+ for(k in 1:(q-1)){
+ y[k+1]<-(y[k]+(1-k/q)*a[k+1])})
+ return(b)
+ }
For exemple, I calculated > vari(ftse,2738,2)
[1] 1.998679> vari(ftse,2738,3)
[1] 2.996469> vari(ftse,2738,4)
[1] 3.993392
But I don't know how to calculate the statistic for this !
Thanks
[[alternative HTML version deleted]]