acc function

Autocorrelation Coefficient

Autocorrelation Coefficient

Calculates the autocorrelation coefficient between a vector and its k-period lag. This can be used as an estimator for rho in an AR(1) process.

acc(x, lag = 1)

Arguments

  • x: a vector, usually residuals.
  • lag: lag for which the autocorrelation should be calculated.

Returns

Autocorrelation coefficient of lag k, numeric value.

Examples

## Simulate AR(1) Process with 30 observations and positive autocorrelation X <- ar1sim(n = 30, u0 = 2.0, rho = 0.7, var.e = 0.1) acc(X$u.sim, lag = 1) ## Equivalent result using acf (stats) acf(X$u.sim, lag.max = 1, plot = FALSE)$acf[2]

References

NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/eda/section3/eda35c.htm.

See Also

lagk, acf.

  • Maintainer: Soenke Hoffmann
  • License: GPL (>= 3)
  • Last published: 2024-12-20