Prediction for a model using a lag as a predictor


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

Not sure about your notation, but in general, making predictions based on other predictions in brms is somewhat combursome. See for workarounds. The only thing that has this predictions behavior automatically are ARMA autocorrelation models. See ?cor_arma