I am working with longitudinal data, where each state (county) has about 40 measurements (health indicators e.g. new T.B infections) over time, and I am interested in fitting a multi-level model where each state gets an intercept and trend over time as follows:
y ~ t + (t | state), data = data, family = gaussian()
There is a possibility that the indicator values within a state are auto-correlated, and that can be captured in brms using:
y ~ t + (t | state) + ar(time = t, gr = state, p = 1), data = data, family = gaussian()
Are there situations when we might need to specify different AR orders for different groups ?, so that state A, has AR(1)
, state B has AR(3)
?
I am hoping this should be guided by plotting the residuals vs fitted, and residuals ACF by state.
Is it easily implemented in brms ?
Thanks.