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.

0 Asked on November 20, 2021

forecasting intermittent time series multivariate regression prophet time series

1 Asked on November 18, 2021

1 Asked on November 18, 2021 by charles-orlando

2 Asked on November 18, 2021

intuition neural networks semi supervised learning transfer learning unsupervised learning

6 Asked on November 18, 2021

1 Asked on November 18, 2021 by imagineerthat

1 Asked on November 18, 2021 by crimson_idiot

0 Asked on November 18, 2021

2 Asked on November 16, 2021 by shial-de

2 Asked on November 16, 2021 by bruce-rawlings

1 Asked on November 16, 2021

0 Asked on November 16, 2021 by dimitriy

0 Asked on November 16, 2021

3 Asked on November 16, 2021

0 Asked on November 16, 2021 by user291976

1 Asked on November 16, 2021 by ben-s

1 Asked on November 16, 2021

1 Asked on November 16, 2021 by ashirwad

Get help from others!

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?

Recent Answers

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

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