I am new to using "brms" and am encountering an issue when specifying the model formula. The error occurs in the specification of the random intercept (three variables/terms denoting the nested, hierarchical group structure). The error message I encounter is shown below:
Setting 'rescor' to FALSE by default for this model
Error in str2lang(x) : <text>:1:17: unexpected ')'
1: ~ var4/var3/var1)
^
Could someone please lend a hand in resolving this issue? Any help would be greatly appreciated. My code is shown below:
result <- brm(
bf(
mvbind(var9, var10, var15, var16) ~ var2 + var13 + var14 + var19 + var20 + var34 + var46 + var47 + var50 + var51 + var52 + var56 + var57 + var59 + var60 + var62 + var65 + var66 + var89 + var90 + var91 + var92 + var93 + var94 + cor_ar(var2 + 1 | var4/var3/var1),
zi ~ var2 + var5 + var114 + cor_ar(var2 + 1 | var4/var3/var1)
),
data = y,
family = zero_inflated_negbinomial(),
iter = 1000,
chains = 4,
future = TRUE)
Other aspects of the model formula that I am unsure of are:
- specification of autoregressive covariance structure using cor_ar()
- setting future = TRUE for parallel computation of chains.
Please let me know if these are specified correctly. Thank you!
cor_ar()? (2) What isstr(y$var2)? (3)cor_ar()is deprecated, you should usear()instead, see here (4) you may have to expand your nested structure explicitly, i.e. into three separate components (var4,var4:var3,var4:var3:var1)