acc | R Documentation |
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)
x |
a vector, usually residuals. |
lag |
lag for which the autocorrelation should be calculated. |
Autocorrelation coefficient of lag k, numeric value.
NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/eda/section3/eda35c.htm.
lagk
, acf
.
## 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]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.