ar.ols(x, aic = TRUE, order.max = NULL, na.action = na.fail,
demean = TRUE, intercept = demean, series, …)TRUE then the Akaike Information
Criterion is used to choose the order of the autoregressive
model. If FALSE, the model of order order.max is
fitted.x minus its mean?deparse(substitute(x))."ar" with the following elements:
aic = TRUE, otherwise it is
order.max.demean is false)
of the series used in fitting and for use in prediction.x - x.mean, or zero if intercept is false.-Inf.order.max argument.NULL. For compatibility with ar.order observations. The first order residuals
are set to NA. If x is a time series, so is
resid."Unconstrained LS".ar.ols fits the general AR model to a possibly non-stationary
and/or multivariate system of series x. The resulting
unconstrained least squares estimates are consistent, even if
some of the series are non-stationary and/or co-integrated.
For definiteness, note that the AR coefficients have the sign in $$x_t - \mu = a_0 + a_1(x_{t-1} - \mu) + \cdots + a_p(x_{t-p} - \mu) + e_t$$ where \(a_0\) is zero unless intercept is true, and
\(\mu\) is the sample mean if demean is true, zero
otherwise. Order selection is done by AIC if aic is true. This is
problematic, as ar.ols does not perform
true maximum likelihood estimation. The AIC is computed as if
the variance estimate (computed from the variance matrix of the
residuals) were the MLE, omitting the determinant term from the
likelihood. Note that this is not the same as the Gaussian
likelihood evaluated at the estimated parameter values. Some care is needed if intercept is true and demean is
false. Only use this is the series are roughly centred on
zero. Otherwise the computations may be inaccurate or fail entirely.arar(lh, method = "burg")
ar.ols(lh)
ar.ols(lh, FALSE, 4) # fit ar(4)
ar.ols(ts.union(BJsales, BJsales.lead))
x <- diff(log(EuStockMarkets))
ar.ols(x, order.max = 6, demean = FALSE, intercept = TRUE)
Run the code above in your browser using DataLab