[R-sig-ME] lmer (lme4): % total variance explained by random effect

Katharina May may.katharina at googlemail.com
Sun Aug 9 22:53:51 CEST 2009


Oh yes, now I get the picture, thanks a lot!
as the variance explained by the random effect for each value of the
covariate is (luckely) more or less similar within my data, I will
take the mean to have an approximation..

Thank you very much,

               -Katharina

2009/8/3 Jarrod Hadfield <j.hadfield at ed.ac.uk>:
> Hi Katharina,
>
> The difficulty with random intercept-slope models is that they (usually)
> give rise to a non-constant variance across the range of the covariate. This
> means that the percentage of variance explained will depend on which value
> of the covariate you evaluate.
>
> If you extract the (co)variance matrix for the intercept-slopes:
>
> V<-VarCorr(name_of_model)$name_of_random_effect
>
> and then set up a design matrix with ones in the first column, and a set of
> covariate values in the second:
>
> Z<-cbind(rep(1,100), seq(-1,1,length=100))
>
> then
>
> M<-diag(Z%*%V%*%t(Z))
>
> is equal to the variance explained by the random effect for each value of
> the covariate.  If there are no other effects M/(M+Ve) gives you the
> proportion explained where Ve is the residual variance.
>
> Hope this helps,
>
> Jarrod
>
> On 2 Aug 2009, at 16:23, Katharina May wrote:
>
>> Hi,
>>
>> just out of curiosity because nobody is answering:
>> is it not not possible to calculate the variance described by a random
>> effect on slope and intercept as percentage of the total variance
>> (variance of random effect + unexplained variance)?
>>
>> Would be more than happy if somebody can help me...
>>
>> Thanks,
>>
>>      Katharina
>>
>>
>> 2009/7/24 Katharina May <may.katharina at googlemail.com>:
>>>
>>> Hello,
>>>
>>> just to say sorry if this questions may be somewhat "inappropriate": I'm
>>> a
>>> bachelor student,
>>> recently started with R and with trying to understand mixed models, but
>>> I'm
>>> somewhat stuck with
>>> the following problem and hope somebody might be able to help me finding
>>> a
>>> solution:
>>>
>>> How can I get the variance (in % of the total variance) which is
>>> explained
>>> by the random effect (both on slope
>>> and intercept together)?
>>> My aim is to say something like xx% of the variance is explained by the
>>> random effect...
>>>
>>> As I'm not sure how to deal with this I would be more than happy for any
>>> hints...
>>>
>>> Thank you very much and With Best Wishes from Freising/Germany,
>>>
>>>                        Katharina
>>>
>>>
>>>
>>> here an example output of a mixed model I use with 1 random effect on
>>> both
>>> slope and intercept,
>>> fitted with method=ML:
>>>
>>>
>>> Linear mixed model fit by maximum likelihood
>>> Formula: log(AGB) ~ log(BM_roots) + (log(BM_roots) |
>>> as.factor(biomass_data[which(biomass_data$woody ==      1), 2]))
>>>   Data: biomass_data[which(biomass_data$woody == 1), ]
>>>   AIC   BIC logLik deviance REMLdev
>>>  588.6 619.6 -288.3    576.6     583
>>> Random effects:
>>>  Groups                                                     Name
>>>                         Variance   Std.Dev.   Corr
>>>  as.factor(biomass_data[which(biomass_data$woody == 1), 2]) (Intercept)
>>> 1.7568529  1.325463
>>>                                                            log(BM_roots)
>>>                          0.0071313  0.084447  -0.393
>>>  Residual
>>> 0.0809467 0.284511
>>> Number of obs: 1282, groups:
>>> as.factor(biomass_data[which(biomass_data$woody
>>> == 1), 2]), 22
>>>
>>> Fixed effects:
>>>              Estimate Std. Error t value
>>> (Intercept)    1.33062    0.29669    4.48
>>> log(BM_roots)  0.93182    0.02441   38.17
>>>
>>> Correlation of Fixed Effects:
>>>            (Intr)
>>> log(BM_rts) -0.446
>>>
>>>
>>
>>
>>
>> --
>> Time flies like an arrow, fruit flies like bananas.
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>



-- 
Time flies like an arrow, fruit flies like bananas.




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