R/FastVR.R

Defines functions FastVR

FastVR <-
function(x,kvec)
{
x <- as.matrix(x)
m <- acf(x,lag.max = max(kvec),plot=FALSE)$acf[2:(max(kvec)+1)]  
VR <- matrix(NA,nrow=length(kvec))
for(i in 1:length(kvec))
{
k <- kvec[i]
w <- (1-(1:(k-1))/k)
VR[i] <- 1+ 2*sum(w*m[1:(k-1)])
}
return(VR)
}

Try the vrtest package in your browser

Any scripts or data that you put into this service are public.

vrtest documentation built on Aug. 31, 2023, 9:08 a.m.