AnswerBun.com

Linear Mixed Regression Variance Decomposition

Cross Validated Asked by lstdnce on January 5, 2022

I’m pretty new to R and was hoping to get some advice on variance decomposition in mixed linear models. Similar to this question;
How to estimate variance components with lmer for models with random effects and compare them with lme results, I have a linear mixed model and would like to be able to estimate how much variability in the outcome variable is related to the random and fixed effect factors (something like R-squared). This appears to be relatively straight forward when there are only fixed factors (e.g. https://murraylax.org/rtutorials/regression_anovatable.html) but I cannot seem to find anything about how to calculate this when there are random effects involved as well.

Here is what I’ve tried so far. I am working with the Orthodont data set as an example. The linear model that I used was:

res <- lmer(distance ~ age*Sex + (1|Subject), data= Orthodont)
summary(res)
anova(res)

The summary was:

Linear mixed model fit by REML ['lmerMod']
Formula: distance ~ age * Sex + (1 | Subject)
   Data: Orthodont

REML criterion at convergence: 433.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.5980 -0.4546  0.0158  0.5024  3.6862 

Random effects:
 Groups   Name        Variance Std.Dev.
 Subject  (Intercept) 3.299    1.816   
 Residual             1.922    1.386   
Number of obs: 108, groups:  Subject, 27

Fixed effects:
              Estimate Std. Error t value
(Intercept)    16.3406     0.9813  16.652
age             0.7844     0.0775  10.121
SexFemale       1.0321     1.5374   0.671
age:SexFemale  -0.3048     0.1214  -2.511

Correlation of Fixed Effects:
            (Intr) age    SexFml
age         -0.869              
SexFemale   -0.638  0.555       
age:SexFeml  0.555 -0.638 -0.869

The anova was:

    Analysis of Variance Table
        npar  Sum Sq Mean Sq  F value
age        1 235.356 235.356 122.4502
Sex        1  17.860  17.860   9.2921
age:Sex    1  12.114  12.114   6.3027

What I would like to determine, is how to calculated the % of variance related to the each parameter. To my understanding, Repeatability can be calculated by dividing the variance contribute of one factor by the total variance. To perform this calculation with this data for age, would it be correct to divide the mean squared error for age by the sum the mean squared error from the ANOVA table and the variances from the random-effects table:

i.e:
235.356/(235.356 + 17.860 + 12.114 + 3.299 + 1.922)

..and repeat something similar for the remaining factors? Something about this seems a bit odd to me. Any help would be appreciated.

Add your own answers!

Related Questions

How to test the influence of an external factor?

0  Asked on December 17, 2020 by pavel

   

Hazards in AFT with Weibull distribution

1  Asked on December 17, 2020 by user11130854

 

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir