Brms - failed convergence and missing contrast


#1

I have a very basic question. I am trying to translate a model I built in a frequentist framework to bayesian using brms. My model does investigate for the effect of 2 categorical variables with 4 and 3 levels each: y~variable 1 * variable 2.
Note that one contrast does not exist. It is not due to missing values, just a contrast to exclude. Let’s say I do not have any records from level1-variable 1:level2-variable 2.
My model fails to converge and I feel like this missing contrast is the reason for that. Indeed, the summary model tries to find an estimate for a contrast that should have been exluded (Rhat and Eff. sample are all good for the rest of my estimates). It seems to me like when the model is searching for the contrasts to look at, it does look at the number of levels as such (based on the levels of the variables to consider) but not at the existing combination between my 2 categorical variables, if what I am writing makes any sense. I have seen brm_multiple to deal with missing values but this is different as I do not deal here with missing values.

Thnak for your help!

Please also provide the following information in addition to your question:

  • Operating System: Window 8.1
  • brms Version:brms_2.6.0

#2

Without seeing the code, this problem it is hard for me to conceptualize to provide feedback. Given that, have you tried starting with a more simple model with your data and then adding variables to try and figure out which variable is causing the problem?


#3

sure, here comes my model. The variable 1 is “region” (3 levels), the variable 2 “butterfly_species”

mod=brm(ind_parasitized|trials(ind_parasitized+ind_nonparasitized)~0+region*butterfly_species
,core=2,data=dat4,iter=5000,warmup=2000,family=binomial)

dat4 include all my butterfly species (4 species) and I get the error message that the model failed to converge. What seems wierd to my is that in the summary, I get a row for the species 4 absent from the 3rd region as if the model tried to fit an estimate for that contrast while this case cannot occur (the 4 species is not present in region 3). Instead, the same model (see below) without the species 4 (data=dat3) run fine and I do not get convergence issue.

mod=brm(ind_parasitized|trials(ind_parasitized+ind_nonparasitized)~0+region*butterfly_species
,core=2,data=dat3,iter=5000,warmup=2000,family=binomial)


#4

brms won’t drop redundant columns from your design matrix. If you want to avoid a fully crossed interaction, you need to compute the contrasts you want to include manually and then add them to you data frame as new variables to be used as predictors.


#5

Thanks Paul, It did not come to my mind but that is logical.