Brms: estimating autocorrelation parameter(s) separately by group

Hi

Can we model autocorrelation parameter(s) separately for each group, something similar to what we can easily do for the sigma parameter.

In other words, can we extend the example below

fit1 <- brm(bf(y ~ x + group, sigma ~ group),
            data = data, family = gaussian())

to

fit1 <- brm(bf(y ~ x + group + ar(p = 1, group = group), sigma ~ group),
            data = data, family = gaussian())

The ar() has an gr option which specifies that correlation structure is applied to observations within the same grouping level (e.g., individuals). But how to estimate ar parameters for group (individuals) level covariate e.g., treatment group.

Thanks

1 Like

I don’t believe this is possible in {brms} currently. But {mvgam} will do that if you treat the separate groups as different levels in the series variable. You can also extend to much more complicated types of dynamics should you need them (ie correlated AR, VAR etc)

2 Likes

It’s not exactly the same thing but in this situation some people use the t-1 DV as predictor which can then be modelled however you want (random effects / interactions etc)