[R-sig-ME] Likelihood ratios
Mike Lawrence
Mike.Lawrence at dal.ca
Tue Jun 1 20:08:44 CEST 2010
After posting this, I thought to contact Pete Dixon himself and indeed
it seems he already coded the functions to obtain a likelihood ratio
comparing two lmer models:
AIC_lmer = function(x){
require(lme4)
print(formula(attr(x,"call")))
summary(x)@AICtab
}
LR_lmer = function(m0,m1){
exp((AIC_lmer(m0)[[1]]-AIC_lmer(m1)[[1]])/2)
}
#example usage:
LR_lmer( my_fit1 , my_fit2 )
On Tue, Jun 1, 2010 at 1:50 PM, Mike Lawrence <Mike.Lawrence at dal.ca> wrote:
> oops, I guess that should be:
>
> LR = exp( anova( fit1 , fit2 )$Chisq[2] / -2 )
>
>
> On Tue, Jun 1, 2010 at 1:28 PM, Mike Lawrence <Mike.Lawrence at dal.ca> wrote:
>> Hi folks,
>>
>> I have 2 lmer fits, one (fit1) nested in the other (fit2), and I'd
>> like to compute the likelihood ratio comparing the models so I can say
>> something like "there is X times more evidence for fit1 than for fit2"
>> (as in Glover & Dixon, 2004, www.ncbi.nlm.nih.gov/pubmed/15732688).
>>
>> I know I can use anova(fit1,fit2) to obtain a null-hypothesis
>> significance test of the fits, and I suspect the output also contains
>> the information I need to make my evidentiary statement, but I'm not
>> confident of what I'm doing here. Is it correct that the reported
>> value of chi-square from anova() is simply the D of the likelihood
>> ratio test (http://en.wikipedia.org/wiki/Likelihood_ratio_test)? If
>> so, does it sound right that I can simply derive the
>> complexity-corrected likelihood ratio as:
>>
>> LR = exp( -2 * anova( fit1 , fit2 )$Chisq[2] )
>>
>> ?
>>
>>
>> Mike
>>
>> --
>> Mike Lawrence
>> Graduate Student
>> Department of Psychology
>> Dalhousie University
>>
>> Looking to arrange a meeting? Check my public calendar:
>> http://tr.im/mikes_public_calendar
>>
>> ~ Certainty is folly... I think. ~
>>
>
>
>
> --
> Mike Lawrence
> Graduate Student
> Department of Psychology
> Dalhousie University
>
> Looking to arrange a meeting? Check my public calendar:
> http://tr.im/mikes_public_calendar
>
> ~ Certainty is folly... I think. ~
>
--
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University
Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar
~ Certainty is folly... I think. ~
More information about the R-sig-mixed-models
mailing list