acc: Autocorrelation Coefficient

View source: R/acc.R

accR Documentation

Autocorrelation Coefficient

Description

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.

Usage

acc(x, lag = 1)

Arguments

x

a vector, usually residuals.

lag

lag for which the autocorrelation should be calculated.

Value

Autocorrelation coefficient of lag k, numeric value.

References

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

See Also

lagk, acf.

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]


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

Related to acc in desk...