Closed matschmitz closed 2 years ago
Hi!
Thank you for this idea and sorry it took me 7 days to catch up with you. I am not sure if this would be possible to implement because the F-statistics that are being leveraged to create the model and semi-partial R2 statistics are based on a nested model comparison where the 'null' model is the intercept only model. So if one were to compare an intercept only model to the 'null' model they would be comparing identical models and would end up with F = 0 and consequently R2 = 0 for the intercept. Does this make sense?
Hi,
Thank you for your answer. Just to be sure I understand, does the semi-partial R2 that is computed with r2beta()
for a given predictor is done by taking into account the F that compares a model with vs. a model without the predictor? For instance, if we want to compute the F for x1
then we would do anova(lm(y ~ 1 + x2), lm(y ~ 1 + x1 + x2))
, right? Following this logic, if we want to test the intercept then we would be comparing anova(lm(y ~ 0 + x1 + x2), lm(y ~ 1 + x1 + x2))
. And if we only have a model with 1 parameter, namely the intercept, we would compare anova(lm(y ~ 0), lm(y ~ 1))
, which in this case is basically a one sample t-test (t.test(y)
), from which the F can be computed (F = t**2
). Of course this logic applies to LM, I'm not sure if it can be extended to LMM or GLMM.
Please let me know if I'm missing something.
Sorry again for my slow response. As you have pointed out, the choice of a null model impacts the value and interpretation of a model R-squared statistic. As far as r2beta is concerned, Edwards et al. wrote a fairly detailed explanation of the null model that r2beta uses, and their paper is publicly available: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2587505/. Section 4.2, 'Choice of null model', explains the rationale for using a null model with intercept and the same covariance structure as the full model.
I am not against the idea of other approaches to computing R-squared for the LMM that would assess a model's intercept. I am not able to actively work on this project at the moment but I can review pull requests or ideas for extending r2beta()
in this direction.
Hello,
It would be really useful if the
r2beta()
function could also return the effect size for the model's intercept. Hope this can be implemented.