I am a relatively new to R package “brms” and am interested in specifying a two-part model containing mu (main model) and hu (hurdle model). The nature of the dataset favors specifying an AR1 autoregressive correlation structure on the model, i.e., the time variable (var9) is grouped by var10 (level 1 grouping variable) nested within var11 (level 2 grouping variable) nested within var12 (level 3 grouping variable).

However, I get an error when I specify an AR1 autoregressive correlation structure on hu (hurdle model). I also tried it for a zero_inflated_negbinomial() model and got the same error when specifying an AR1 autoregressive correlation structure on zi (zero-inflation model).

My question is two-fold.

- Is being unable to specify an AR1 autoregressive correlation structure on hu (hurdle model)/zi (zero-inflation model) simply a limitation of “brms” R package?
- Is specifying an AR1 autoregressive correlation structure on hu (hurdle model)/zi (zero-inflation model) statistically valid/invalid [Note: this question is partly motivated by my inability to run such a model in other R packages such as “glmmTMB”]?

Please advice. I have included my R code below.

```
prior <- get_prior(bf(
mvbind(var1 + var2 + var3 + var4) ~ var5 + var6 + ar(time = var9, gr = var12:var11:var10, p = 1),
hu ~ var7 + var8 + ar(time = var9, gr = var12:var11:var10, p = 1)
),
data = y,
family = hurdle_negbinomial())
> Error: Explicit covariance terms can only be specified on 'mu'.
```

Sorry nobody’s answered this—we’re getting overwhelmed with `brms`

questions and the original designer, @paul.buerkner, has largely moved on to other projects (we will still support `brms`

, but we don’t have enough hands on deck to answer all the mailing list queries).

Base Stan is much more flexible. The brms package is more limited in the models you can express—it’s not quite menu driven, but it’s close.

Strictly speaking, an AR(1) model is over continuous variables with $u_{t + 1} \sim \textrm{normal}(\alpha + \beta \cdot u_t, \sigma)`. What is your equivalent of u_t here? Was the intention to add a random effect that went into one of the hurdle negative binomial parameters? That you can do in Stan, but I’m not sure about brms.

1 Like

Just to confirm what Bob wrote: it is currently not possible with brms to specify an AR correlation structure over zi or hu parameters.

Hello, Bob! Sorry for the delay in getting back. I certainly understand the difficulty for the moderators in staying on top of the numerous requests for help that are received daily on Stan Forums. With that said, I am very grateful for the response and appreciate yours and Paul’s input for resolving my issue.

I have not tried running this model in Base Stan and will definitely try it.

Assuming I interpreted your remark correctly, my time variable (ut) in the model is var9. It is categorical with 165 levels. The choice of AR1 was informed by having time points which are equally spaced. And yes, I intended to add a random effect as a hurdle negative binomial parameter. However, I am concerned whether it is the correct modelling approach since I haven’t been successful in running it. Would love to hear your thoughts on it.

Thank you for clarifying, Paul! As suggested by Bob, I will give Base Stan a try.