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:
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?
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.
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.