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)
}
andronikoss/desk documentation built on June 3, 2017, 7:05 p.m.