[R-sig-ME] test significance of single random effect

Tom Van Dooren t.j.m.van.dooren at biology.leidenuniv.nl
Tue Nov 17 10:23:24 CET 2009


Hi Ben,
yes I did. The Orthodont example in the LRTSim() help file ran  
perfectly well using lme(), but not with lmer().
Do you think it is OK to use simulated log-likelihoods as a test  
statistic, instead of a likelihood ratio?
Cheers, Tom


Quoting Ben Bolker <bolker at ufl.edu>:

>
>   Have you tried the RLRsim package??
>
> Tom Van Dooren wrote:
>> I tried to find an easy way to test whether the random effect would be
>> significant in a (generalized) mixed model with a single random effect.
>> It annoyed me that log-likelihoods of lm or glm and lmer are not
>> necesarily directly comparable -> trouble with calculating likelihood
>> ratios.
>> What do members of this list think of the following simulation approach?
>> It basically amounts to simulating a distribution for the log
>> likelihood, given the null hypothesis that there is no random effect
>> variance and that the fixed effect model is correct.
>>
>>
>> library(lme4)
>> mm1 <- lmer(Reaction ~ Days + (1|Subject), sleepstudy)
>> lm1<- lm(Reaction ~ Days, sleepstudy)
>>
>>
>> LL<-numeric(500)
>> for(i in 1:500){
>> resp<-simulate(lm1)
>> LL[i]<-logLik(lmer(resp[,1] ~ Days + (1|Subject), sleepstudy))
>> }
>>
>> hist(LL)
>> logLik(mm1)
>> mean(LL>logLik(mm1))
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
> --
> Ben Bolker
> Associate professor, Biology Dep't, Univ. of Florida
> bolker at ufl.edu / www.zoology.ufl.edu/bolker
> GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc
>




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