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.

2 Asked on December 21, 2020 by uzbekistan

dynamic regression fixed effects model generalized moments panel data random effects model

2 Asked on December 20, 2020 by david-ernst

anova experiment design multiple comparisons post hoc statistical power

0 Asked on December 19, 2020 by user276835

conditional probability machine learning mathematical statistics nested data regression

0 Asked on December 18, 2020 by oumayma-bounouh

forecast combination forecasting normal distribution pdf weights

1 Asked on December 18, 2020 by farzad

0 Asked on December 18, 2020 by germania

0 Asked on December 17, 2020 by pavel

1 Asked on December 17, 2020

0 Asked on December 16, 2020 by whuber

1 Asked on December 16, 2020 by jlearner

1 Asked on December 16, 2020 by ber08

forecasting garch hidden markov model variance volatility forecasting

0 Asked on December 16, 2020 by noumenal

1 Asked on December 15, 2020 by emmettcc

1 Asked on December 15, 2020 by suzee

generalized linear model machine learning multiple regression neural networks regression

0 Asked on December 15, 2020

1 Asked on December 14, 2020 by bandit_king28

9 Asked on December 13, 2020 by jessica

1 Asked on December 13, 2020 by kh_one

1 Asked on December 13, 2020 by l-sicilis

Get help from others!

Recent Answers

- Lex on Does Google Analytics track 404 page responses as valid page views?
- Joshua Engel on Why fry rice before boiling?
- Jon Church on Why fry rice before boiling?
- Peter Machado on Why fry rice before boiling?
- haakon.io on Why fry rice before boiling?

Recent Questions

- How Do I Get The Ifruit App Off Of Gta 5 / Grand Theft Auto 5
- Iv’e designed a space elevator using a series of lasers. do you know anybody i could submit the designs too that could manufacture the concept and put it to use
- Need help finding a book. Female OP protagonist, magic
- Why is the WWF pending games (“Your turn”) area replaced w/ a column of “Bonus & Reward”gift boxes?
- Does Google Analytics track 404 page responses as valid page views?

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