[R-sig-ME] Testing whether I need a random effect?

David Duffy davidD at qimr.edu.au
Wed Aug 18 03:44:47 CEST 2010


On Tue, 17 Aug 2010, Ben Bolker wrote:

>  see http://glmm.wikidot.com/faq , "How can I test whether a random
> effect is significant?" (there aren't worked examples there -- anyone
> want to donate some?)

One example, but with shortcomings - I think you need random effects for 
visit *and* subject for a Poisson.  If I understand correctly, 
a negative binomial GLMM model incorporates the subject effect in that bit 
of the model.

library(MASS)
library(glmmML)
#
# an advantage of glmmML is that it uses the same constants etc 
# in its likelihood.  But it is only applicable for one random effect 
# (intercept)
#
m1 <- glm(y ~ lbase*trt + lage + V4, data=epil, family=poisson())
m2 <- glmmML(y ~ lbase*trt + lage + V4, cluster=subject, data=epil, family=poisson())

...
Scale parameter in mixing distribution:  0.5011 gaussian
Std. Error:                              0.05693

A Wald test would look impressive.

lrts <- m1$deviance-m2$deviance

This should be distributed 1/2*chisq(df=1)+1/2*chisq(df=0)

Cheers, David Duffy

| David Duffy (MBBS PhD)                                         ,-_|\
| email: davidD at qimr.edu.au  ph: INT+61+7+3362-0217 fax: -0101  /     *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v




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