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
new var_type "ran_pars" #90
Conversation
This is a 🌟 fantastic 🌟 pull request! Thank you! I love adding the type as There is a change I think that should be made. The variable column was being defined as the group variable. This could make sense for a simple random intercept model. But when we have a random slope, the variable name is now the grouping variable rather than the variable name the random slope's associated variable. In the example below, we have a fixed and random slope on stage, but the variable is assigned as grade (the grouping variable). I think the variable should be a combination of the original term and the group,. For example, the new variable could be library(broom.helpers)
# random intercept and slope on stage, grouped by grade
mod <- lme4::lmer(age ~ stage + (stage|grade) + (1|grade), gtsummary::trial)
#> boundary (singular) fit: see ?isSingular
tidy_plus_plus(mod, tidy_fun = broom.mixed::tidy) %>% knitr::kable()
#> Registered S3 method overwritten by 'broom.mixed':
#> method from
#> tidy.gamlss broom
Created on 2021-01-27 by the reprex package (v0.3.0) |
In your example, there is an issue because two terms are identical ( If I do not populate library(broom.helpers)
library(broom.mixed)
#> Registered S3 method overwritten by 'broom.mixed':
#> method from
#> tidy.gamlss broom
mod <- lme4::lmer(age ~ stage + (stage|grade) + (1|grade), gtsummary::trial)
#> boundary (singular) fit: see ?isSingular
mod %>% tidy_plus_plus() %>% knitr::kable()
mod %>% tidy_plus_plus(add_header_rows = TRUE) %>% knitr::kable()
Created on 2021-01-28 by the reprex package (v0.3.0) Some potential solutions:
|
After reading https://cran.r-project.org/web/packages/broom.mixed/vignettes/broom_mixed_intro.html I'm thinking about:
|
or maybe create a function |
That sounds perfect
👍🏼
I think this could be helpful, but also maybe not required. Since both the original term and the group column are returned, there would be no need to disambiguate or parse the new variable name?
|
Codecov Report
@@ Coverage Diff @@
## master #90 +/- ##
=======================================
Coverage 99.85% 99.85%
=======================================
Files 33 33
Lines 1375 1396 +21
=======================================
+ Hits 1373 1394 +21
Misses 2 2
|
OK. For now, let's keep The other points have been implementd. |
fix #88