[R-sig-ME] Variance explained by random factor

Andrew Beckerman a.beckerman at sheffield.ac.uk
Thu Aug 14 12:46:48 CEST 2008


I think i failed to copy this to the list (it went directly to Ana) -  
perhaps pertinent to the LRT result.....

ma1 and mixed differ in both fixed and random effects..... mixed has  
the interaction between fixed effects..... not sure that was intended,  
but you are unlikely to be picking up differences caused only by the  
random effects in your use of the LRT.

Andrew



On 14 Aug 2008, at 11:00, Renwick, A. R. wrote:

> Fanatstic.  Thanks such a lot for that command.
> The
> 'ldL2' = 2.178613e-11
> 'usqr' = 0
>
> Is it not strange though that the test to see if sig difference  
> between glm and glmm is so highly significant?
>
> as.numeric(2*(logLik(mixed)-logLik(ma)))
> #99.16136
> pchisq(99.16136,1,lower=FALSE)
> #2.327441e-23  so should use a GLMM
>
> -----Original Message-----
> From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of  
> Douglas Bates
> Sent: 14 August 2008 10:44
> To: Renwick, A. R.
> Cc: Ken Beath; r-sig-mixed-models at r-project.org
> Subject: Re: [R-sig-ME] Variance explained by random factor
>
> On Thu, Aug 14, 2008 at 11:24 AM, Renwick, A. R.  
> <a.renwick at abdn.ac.uk> wrote:
>> Many apologise but the glm model I compared was ma not ma1 and thus  
>> did have the interaction term:
>
>> ma<-glm(RoundedOverlap~sess+breedfem+sess:breedfem
>> ,family=poisson,data=Male)
>> mixed<-lmer(RoundedOverlap~sess+breedfem+sess:breedfem+(1| 
>> Site),family
>> =poisson,data=Male)
>
> In that case it could be that the deviance or log-likelihood is not  
> being evaluated correctly in glmer.  Look at the slot named 'deviance'
> in the lmer fit.  It should be a named numeric vector.  The names of  
> interest are 'disc', the discrepancy for the generalized linear  
> models (this is the deviance without the compensation for the null  
> deviance), 'ldL2', the logarithm of the square of the determinant of  
> the Cholesky factor of a second-order term, and usqr, the squared  
> length of the transformed random effects.  For a mixed-effects model  
> in which the variance of the random effects is estimated as zero,  
> both 'ldL2' and 'usqr' should be zero.
>
> You can check these values in
>
> mixed at deviance
>> -----Original Message-----
>> From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of
>> Douglas Bates
>> Sent: 14 August 2008 10:22
>> To: Ken Beath
>> Cc: Renwick, A. R.; r-sig-mixed-models at r-project.org
>> Subject: Re: [R-sig-ME] Variance explained by random factor
>>
>> On Thu, Aug 14, 2008 at 11:10 AM, Ken Beath <ken at kjbeath.com.au>  
>> wrote:
>>> On 14/08/2008, at 1:17 AM, Renwick, A. R. wrote:
>>>
>>>>
>>>> I am currently trying to run a lmer model with poisson  
>>>> distrubution.
>>>> I tested the model with a model without the random effect and it
>>>> inferred that I should include the random effect:
>>>>
>>>> ma1<-glm(RoundedOverlap~sess+breedfem,family=poisson,data=Male)
>>>>
>>>> mixed<-lmer(RoundedOverlap~sess+breedfem+sess:breedfem+(1| 
>>>> Site),fami
>>>> l
>>>> y=poisson,data=Male)
>>>>
>>>> #test to see if sig difference between glm and glmm
>>>> as.numeric(2*(logLik(mixed)-logLik(ma)))
>>>> #99.16136
>>>> pchisq(99.16136,1,lower=FALSE)
>>>> #2.327441e-23  so should use a GLMM
>>>>
>>>
>>> The problem may be due to the random effects model containing an
>>> interaction term sess:breedfem that the glm doesn't.
>>
>> I agree.  The result from the likelihood ratio test is actually  
>> evaluating the significance of the interaction term, not the random  
>> effects term.
>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>
>>
>> The University of Aberdeen is a charity registered in Scotland, No  
>> SC013683.
>>
>
>
> The University of Aberdeen is a charity registered in Scotland, No  
> SC013683.
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




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