-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explained Variance for random slopes model #601
Comments
With random slopes, the value of R2 varies as a function of the slope value, so there is no single R2 value for the model. I would recommend against using any sort of R2 for this sort of model. Or, if you really need to have one, using a generic R2 formula based on the predicted values for the model. Note that such a summary is still a poor index of model performance because it doesn't really describe predictive power for any specific person and is dependent on the exact cases in your sample.
|
I see your point, but actually I am not dead set on obtaining an R2 value, especially if it is not a good measure for this kind of model. I tried out the performance::icc() function, but I see that it has the same problem with random slopes in the model. In general, what I would like to obtain is some kind of measure of the importance of the grouping levels (ideally shown with a bar plot). Is there a way to do this king of analysis (which I see people call "variance decomposition") on random slopes mixed models, using the performance package? |
Any variance decomposition statistic (R2, ICC, etc) has the same basic issue--there isn't any single value that describes the importance of the grouping variable for all cases. Instead it depends on the value of the predictor with the random slope. This post describes the issue well. https://stats.stackexchange.com/a/318418/364001 Sometimes you see ICC curves that plot the ICC for varying levels of the predictor, like this Personally, I suggest just interpreting the values of the SD for the random intercepts and slopes in your model |
In the end I changed my approach a bit, and now I have a model without random slopes, so I think it should work fine. Do you know why in the help for the r2_nakagawa function, under "Details", it says
even if the R2 is not a "good" measure when there are random slopes? I'm not being argumentative, just trying to understand better the problem. |
I am trying to plot the proportion of explained variance from a linear model with random effects on intercept and slopes. However, the function r2_nakagawa() gives me two warnings regarding the random slopes.
I am attaching a minimal reproducible example, showing the same warnings that I get when using my own data.
Thank you for your work on this super useful package, by the way :)
Created on 2023-08-01 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: