Extracting Categorical Group Effects from mixed effect Dirichlet regression

Hello all!

I am analyzing some multi-level proportion data using a Dirichlet as the outcome distribution in a mixed effects regression, and have successfully fit the models, as well as extracted the fixed effects for my categorical effect of interest. What I am struggling with now is how to get group level posteriors for my categorical effect of interest. Now, I think I am having difficulty with two distinct aspects of the problem: 1) how to extract group level effects generally, and 2) how to calculate out expected effects for each level of my categorical variable.

Here is the code to run the regression:

mod = brm(dir_resp ~ Modality + (Modality|family) + (1|label),
                                       data = concept_dat_prop_lang_fordirich,
                                       family = dirichlet)

dir_resp has three categories to it (three proportions, summing to 1). Modality has three categories (Not strictly important to this question, but the response and Modality have the same three categories).

I can run

conditional_effects(mod,categorical = T)

And I get out this figure:

Which is perfect, and shows the fixed effects for each category of Modality on each category of response.

However, when I run:

conditional_effects(concept_dat_prop_lang_dirich_mod,categorical = T, re_formula = NULL)

I get a Error: NAs are not allowed in grouping variables. I’m not quite sure why this error is occurring, as there are no NA values in the grouping variables (and even when I remove groups that don’t cover all categories, I still get this error).

I can extract, using tidybayes the posterior samples for my random effects, which is great! But what I am stumbling on is how to calculate the conditional effects for each response category when, due to the nature of the Dirichlet outcome, the effect of Modality on the reference category of the response is not explicitly calculated.

So two broad questions:

  1. Can I use conditional_effects to extract these group level effects, and if so, what am I doing wrong with using re_formula = NULL
  2. If I need to calculate the marginal effects out by hand, how to go about calculating the group level effects for the reference category of the Dirichlet response (There are 3 categories of response, three of Modality, which means 9 total effects. I get out of the regression 6 effects).

Thank you!
Teague

2 Likes