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
Bug: Cannot reorder residual SD for mixed effects models #757
Comments
I'm new to using modelsummary so I'm still familiarizing myself with it, but I believe the issue here is that the residual SD and other variance components have different group identifiers, which prevents the desired reordering. get_estimates(sleepstudy_fit)
term estimate std.error conf.level conf.low conf.high
1 (Intercept) 251.40510485 6.824597 0.95 237.935457 264.8748
2 Days 10.46728596 1.545790 0.95 7.416374 13.5182
3 SD (Intercept Subject) 24.74065800 NA 0.95 NA NA
4 SD (Days Subject) 5.92213766 NA 0.95 NA NA
5 Cor (Intercept~Days Subject) 0.06555124 NA 0.95 NA NA
6 SD (Observations) 25.59179572 NA 0.95 NA NA
statistic df.error p.value effect group s.value
1 36.838090 174 4.372791e-84 fixed 276.9
2 6.771481 174 1.882719e-10 fixed 32.3
3 NA NA NA random Subject NA
4 NA NA NA random Subject NA
5 NA NA NA random Subject NA
6 NA NA NA random Residual NA Note that changing the |
Yep, I think you're diagnostic is correct. You can use |
That said, I do agree that this is counterintuitive. I pushed a commit to Github. If you install it an restart R, you’ll get this: library(lme4)
library(modelsummary)
sleepstudy_fit <- lmer(Reaction ~ Days + I(Days^2) + (Days | Subject), sleepstudy)
modelsummary(
sleepstudy_fit,
coef_map = c("SD (Observations)", "(Intercept)", "Days")
)
|
Thanks Vincent, great package by the way! |
Glad you like it! |
The
coef_map
argument is unable to reorder the residual SD for mixed effects models; the residual SD is always forced to the bottom. Here's a reprex:Created on 2024-04-23 with reprex v2.0.2
Session info:
The text was updated successfully, but these errors were encountered: