Compute the autocorrelation of the residuals
Arguments
- fitobj
Output of the
fitfunction.- lag
The lag of the autocorrelation to compute. Defaults to
1.
Value
Numeric denoting the autocorrelation of the residuals. If multiple dimensions exist in the residuals, then the autocorrelation will be computed for each dimension separately and a mean of them will be returned.
Examples
# Generate a dataset
data <- dataset(Y = rnorm(100), X = rnorm(100)) |>
suppressWarnings()
# Estimate the exponential discounting model on these data
fitobj <- fit(
exponential(),
data,
itermax = 50,
trace = FALSE
)
# Compute the autocorrelation based on this fitobj
autocorrelation(fitobj)
#> [1] -0.1579376