Prediction for a model using a lag as a predictor


#1

Hello,

Suppose i had a model like brm(y ~ x+lag(y,5), where x is an integer from 1...n. How would i go about making predictions for x in [n+1, n+k]? My confusion is how to incorporate the lags (which will need to be based on predictions).

Thanks much


#2

Not sure about your notation, but in general, making predictions based on other predictions in brms is somewhat combursome. See https://github.com/paul-buerkner/brms/issues/303 for workarounds. The only thing that has this predictions behavior automatically are ARMA autocorrelation models. See ?cor_arma