[R] model comparison with mixed effects glm

Spencer Graves spencer.graves at pdf.com
Tue Apr 4 21:28:34 CEST 2006


	  You are correct on both counts.  The exta line is inserted below; 
obviously, I had it but failed to copy it into the email.

	  And you are also correct that one needs to be careful that both glm 
and lmer are using comparable definitions for the log(likelihood).  My 
crude check on that was just to look compare the lglk0 and lglk.ID1.; 
the numbers seemed too close to be based on different definitions.  In 
addition, I think I may have checked this once before, but my memory 
could be faulty on that point.

	  Thanks for pointing out both deficiencies in my reply.
	  spencer graves

hadley wickham wrote:

>>### To get around that, I computed 2*log(likelihood ratio) manually:
>>
>>lglk0 <- logLik(fit0)
>>lglk.ID1. <- logLik(Fit.ID1.)
chisq.ID. <- 2*(lglk.ID1.-lglk0)
>>pchisq(as.numeric(chisq.ID.), 1, lower=FALSE)
>> > [1] 0.008545848
> 
> 
> (I think you're missing a line in there)
> 
> But isn't this rather perilous unless you are confident that the two
> models are using exactly the same formulation of the likelihood?  (ie.
> that they are truly nested)
> 
> Hadley




More information about the R-help mailing list