# Is it possible to include a 3rd order autocorrelation ar(3) term in a brm model in R without including the first ar(1) & second order ar(2) terms?

I’m fitting a simple linear model to time series data with brm() from the brms package, and I’d like to include temporal autocorrelation which is quite clear in the residuals of a model without it (via pacf()). I’m examining the links between a predictor and the response 1-3 time steps (weeks) ahead, to see how useful the predictor might be in predicting the response. For the 1 step ahead predictive model, an ar(1) structure works fine:

fit1 ← brm(y_t_plus1 ~ x, ar(p = 1), data = dm1)

For this 1 week ahead model the autocorrelation term is quite strong, ar[1]=0.91, whereas the predictor (x) offers little explanatory value, suggesting that the best prediction we can make for y (t+1) it something similar to the current value y(t) since the two are highly (auto)correlated. But for 3 (or 2) weeks ahead, I’d like to use a model that only makes use of information that would be available at the time of the prediction. For a prediction 3 weeks ahead, an ar(p=1) model would make use of data 2 weeks into the future. If I use a model of the form:

fit3 ← brm(y_t_plus3 ~ x, ar(p = 3), data = dm1)

this fits a model with ar(3), ar(2) and ar(1) terms, but the value of y_t_plus_1 and y_t_plus_2 wouldn’t be known at the time of prediction since they are in the future. Thus I’d like to fit a model that only has the ar(3) term but not the ar(1) or ar(2) terms. I obviously could fit a model with a fixed effect for the autocorrelation of the response variable:

fit_fixed ← lm(y_t_plus3 ~ x+y_t_plus_0, data = dm1)

But this is obviously different from fitting the autocorrelation as a part of the variance-covariance matrix. I was hoping there might be something available in brm() syntax akin to removing the intercept in a simple linear model, e.g. lm(y~-1+x).

I read through the manual for brms, and searched for possible examples that might have this but no luck so far.
Thank you!

1 Like

I’m not sure whether or not you can suppress these lower-order terms via `brms` syntax (or perhaps via the prior), but I’m also not convinced that you want to. It could well turn out that the best way to predict several weeks into the future is simply to simulate forward via an `ar(1)` structure.

If desired, you can evaluate the `ar(1)` or the `ar(3)` model (including the lower-order terms as well) by looking at the predictive performance on the final timepoints of training data wherein the final, penultimate, and antepenultimate datapoints are all withheld during model fitting. That is, see how well the model can predict 3 weeks ahead when it does still contain the `ar(1)` term.

1 Like

Thank you. I’ll give that a try. It’d be great to also be able to compare those to a model with the ar(3) term but without the ar(1) and ar(2) terms.