How does one specify a lag/lead in a formula with time series cross section data?
I effectively want something like
bf(Y ~ lag(X, time=‘t’, group=‘country’, period=1))
But I have been unable to find anything like that in the documentation. There’s an allusion to being able to use indexes in the lengthy (formula help document).
For fixed covariates, I could precompute lags and include them as columns in the dataframe. In my specific case though, I’m imputing missing values and I want to be able to refer to that latent variable column in terms of lags in other formulas.
bf(Y~ lag(mi(X), time=‘t’, group=‘country’, period=1) + lag(mi(X), time=‘t’, group=‘country’, period=2))
bf(Z~ lag(mi(X), time=‘t’, group=‘country’, period=3) )
bf(X | mi() ~ some_covariates )
The only relevant post on the forum I can find is “Prediction for a model using a lag as a predictor”.