acc: Autocorrelation coefficient.

Description Usage Arguments Value References See Also Examples

View source: R/acc.R

Description

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

Usage

1
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

1
2
3
4
5
6
# 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]

andronikoss/desk documentation built on June 3, 2017, 7:05 p.m.