R/acc.R

Defines functions acc

Documented in acc

acc = function(x, lag = 1){
  n = length(x)
  x1 = x[1:(n-lag)]
  x2 = x[(lag+1):n]
  out = sum((x1 - mean(x)) * (x2 - mean(x))) / sum( (x - mean(x))^2 )
  return(out)
}

Try the desk package in your browser

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

desk documentation built on May 29, 2024, 6:05 a.m.