Skip to contents

The ACF at each lag with the same denominator throughout, which is what keeps the estimated sequence positive semi-definite – dividing by the number of terms actually summed at each lag does not, and produces "autocorrelations" no stationary process could have.

Usage

morie_autocorrelation(y, lag_max = NULL, ci = 0.95)

Arguments

y

series.

lag_max

largest lag; defaults to 10 log10(n).

ci

confidence level for the bands.

Value

list with acf (lag 0 first), lags, ci_bound, significant, ljung_box, ljung_box_p.

Details

The white-noise bands are a per-lag test, so about one spike in 20 will cross them by chance. Read the Ljung-Box statistic, which tests all lags jointly. After fitting a model, subtract the degrees of freedom it consumed before interpreting either.

References

Ljung, G. M. and Box, G. E. P. (1978). On a measure of lack of fit in time series models. Biometrika, 65(2), 297-303.

Examples

set.seed(1)
round(morie_autocorrelation(arima.sim(list(ar = 0.6), 200))$acf[2], 2)
#> [1] 0.58