ar.ols package:stats R Documentation _F_i_t _A_u_t_o_r_e_g_r_e_s_s_i_v_e _M_o_d_e_l_s _t_o _T_i_m_e _S_e_r_i_e_s _b_y _O_L_S _D_e_s_c_r_i_p_t_i_o_n: Fit an autoregressive time series model to the data by ordinary least squares, by default selecting the complexity by AIC. _U_s_a_g_e: ar.ols(x, aic = TRUE, order.max = NULL, na.action = na.fail, demean = TRUE, intercept = demean, series, ...) _A_r_g_u_m_e_n_t_s: x: A univariate or multivariate time series. aic: Logical flag. If '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. order.max: Maximum order (or order) of model to fit. Defaults to 10*log10(N) where N is the number of observations. na.action: function to be called to handle missing values. demean: should the AR model be for 'x' minus its mean? intercept: should a separate intercept term be fitted? series: names for the series. Defaults to 'deparse(substitute(x))'. ...: further arguments to be passed to or from methods. _D_e_t_a_i_l_s: '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] - m) = a[0] + a[1]*(x[t-1] - m) + ... + a[p]*(x[t-p] - m) + e[t]' where a[0] is zero unless 'intercept' is true, and m 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. _V_a_l_u_e: A list of class '"ar"' with the following elements: order: The order of the fitted model. This is chosen by minimizing the AIC if 'aic=TRUE', otherwise it is 'order.max'. ar: Estimated autoregression coefficients for the fitted model. var.pred: The prediction variance: an estimate of the portion of the variance of the time series that is not explained by the autoregressive model. x.mean: The estimated mean (or zero if 'demean' is false) of the series used in fitting and for use in prediction. x.intercept: The intercept in the model for 'x - x.mean', or zero if 'intercept' is false. aic: The value of the 'aic' argument. n.used: The number of observations in the time series. order.max: The value of the 'order.max' argument. partialacf: 'NULL'. For compatibility with 'ar'. resid: residuals from the fitted model, conditioning on the first 'order' observations. The first 'order' residuals are set to 'NA'. If 'x' is a time series, so is 'resid'. method: The character string '"Unconstrained LS"'. series: The name(s) of the time series. frequency: The frequency of the time series. call: The matched call. asy.se.coef: The asymptotic-theory standard errors of the coefficient estimates. _A_u_t_h_o_r(_s): Adrian Trapletti, Brian Ripley. _R_e_f_e_r_e_n_c_e_s: Luetkepohl, H. (1991): _Introduction to Multiple Time Series Analysis._ Springer Verlag, NY, pp. 368-370. _S_e_e _A_l_s_o: 'ar' _E_x_a_m_p_l_e_s: ar(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)