Skip to content

Log likelihood of a glmer() binomial model .

3 messages · Ben Bolker, Juho Kristian Ruohonen

#
Sorry to revive the thread after 21 months, but the topic has just become
highly relevant. My question concerns the following remark by Ben:

As far as what predict() does: depending on the value of re.form, it
Does "marginal predictions" here mean predictions based exclusively on the
"population-averaged" fixed-effect estimates that are equivalent to ones
calculated by *gee()* from the *gee* library and *geeglm()* from the *geepack
*library? Or does it mean predictions calculated using the GLMM estimates
of the fixed effects and then averaged with respect to the estimated
random-effects distribution? If it means the former, aren't those
predictions easily obtainable through a standard GLM that ignores the
clustering? If it means the latter, could someone please point out how
exactly to calculate such marginal predictions using GLMMadaptive? I've
been trying to figure out how to manually calculate the marginal (latter
sense) LL for binomial GLMMs, with no success so far...

Best,

J

la 20. huhtik. 2019 klo 17.51 Ben Bolker (bbolker at gmail.com) kirjoitti:

  
  
#
"marginal" is unfortunately a word that has different meanings in 
different contexts, I'm still trying to sort it out in my own mind.

   GLMMadaptive doesn't do marginal _predictions_ but it does do 
marginal _coefficients_.

   I put up some example workings at

http://bbolker.github.io/mixedmodels-misc/notes/marginal_ex.html?de49a7770f7

  (the hash at the end may be unnecessary for you).

  If you average across simulations with newdata= set that should give 
you marginal predictions ...
On 1/30/21 9:23 AM, Juho Kristian Ruohonen wrote:
#
Dear list/Ben,

GLMMadaptive doesn't do marginal _predictions_ but it does do
Thanks for clearing that up!
With *newdata *set to what? I assume I'd have to use the original dataset
while somehow emulating the estimated RE distribution. However, I can't
seem to make anything work. A simple example with a simple dataset:
What I'm trying to learn is how to calculate or, failing that, simulate
this "marginal" deviance. My first impulse is to simply hand-calculate a
deviance from fitted values with all RE's set to their mean of 0. Given
that the assumed RE distribution is normal and hence symmetric, my
intuition is that the result should equal the result from integrating over
the estimated RE distribution. But that fails to happen:

*-2*sum(dbinom(y, size = 1, prob = predict(glmm, re.form = NA,   type =
So my next avenue is to do as Ben seems to suggest, i.e. use the means of
simulated "marginal" responses from the model as fitted values. Indeed,
*simulate.merMod()* with *use.u = FALSE* should be exactly what we want,
given that its documentation says the following:

use.u
But alas:

*-2*sum(dbinom(y, 1, prob = rowMeans(simulate(glmm, nsim = 1e4, seed =
The resulting deviance is off no matter what random seed I set. As a
sidenote, it seems to equal the deviance obtained by setting all random
effects to 0, just as my unreliable intuition suggested. But it's the wrong
result nonetheless.

Hence I'm at my wits' end. How does one calculate or simulate the marginal
deviance of a binary GLMM?

Best,

J

la 30. tammik. 2021 klo 22.55 Ben Bolker (bbolker at gmail.com) kirjoitti: