[R-sig-ME] Log likelihood of a glmer() binomial model .

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Mon Apr 22 09:49:09 CEST 2019

On 22/04/19 4:27 AM, Juho Kristian Ruohonen wrote:


> As alluded to by Ben, predict() can certainly provide fitted 
> probabilities for the validation set with the random effects taken into 
> account. This is achieved by the re.form = NULL argument. However -- and 
> I'll be happy to be corrected on this -- the problem is that dbinom() 
> will calculate a (log)likelihood of the observed responses assuming a 
> regular binomial PMF, which does not apply in the case of a 
> mixed-effects model. Thus the result will not equal the loglikelihood 
> that is maximized in the fitting process, i.e. will not equal 
> logLik(validationFit) unless it's a standard logistic GLM.

OK.  I have finally understood the stupidity that I was perpetrating. 
It can expressed succinctly as thinking that E(f(P)) = f(E(P)).  Which 
is true only if f() is an affine function.  I used to go off my trolley 
complaining when undergraduate students committed such atrocities. :-(

(In the foregoing f() may be taken to be the binomial probability 
function with some fixed "x" value, and P to be the success probability.
So even if predict.merMod() delivered E(P) as I previously thought it 
did, my so called cross-validated log likelihood would still be incorrect.)

Sorry for all the noise.



Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

More information about the R-sig-mixed-models mailing list