0
$\begingroup$

I tried using BinomialBayesMixedGLM model in python to fit a logistic model with mixed effects, and for comparison, also fit a binomial model with Lmer from pymer4 library. The fitting was done as follows:

  1. Using BinomialBayesMixedGLM:

random = {"Intercept RE": '0 + C(G)', "X2 RE": '0 + C(G) * X2'}

model = BinomialBayesMixedGLM.from_formula('Y ~ X1 + X2', random, data)

  1. using Lmer:

model = Lmer('Y ~ X1 + X2 + (1 + X2 | G)', data=data, family = 'binomial')

However, the posterior mean of the coefficients returned by BinomialBayesMixedGLM is quite different from the fixed effect coefficients returned by Lmer. For X2 variable they even have opposite signs. Why would this be the case ?

$\endgroup$
2
  • $\begingroup$ Does BinomialBayesMixedGLM default to making the two random effects independent? Some packages do, but lmer doesn't. $\endgroup$ Commented Jun 28, 2021 at 6:39
  • $\begingroup$ oh good point Thomas! I am not sure and I haven't seen it in the documentation, but will go back to double check. Thank you! $\endgroup$
    – Fiori
    Commented Jun 28, 2021 at 16:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.