-
Notifications
You must be signed in to change notification settings - Fork 8
Support for pairwise contrasts from emmeans #192
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
Conversation
larmarange
commented
Nov 11, 2022
•
edited
Loading
edited
- to be finalised
- update doc
- add test
- update vignette
- update NEWS and README
hey hey @larmarange ! this all looks great! I was doing some testing with other types of contrasts. do you think we should document in the help file how various contrasts are handled? for example, if you make a ploy contrast from a factor variable, it is ignored by this new function. |
I need to check. I guess that this is not covered by emmeans. But not sure |
It seems to work indeed. What was your exact test? library(gtsummary)
library(broom.helpers)
#>
#> Attachement du package : 'broom.helpers'
#> Les objets suivants sont masqués depuis 'package:gtsummary':
#>
#> all_continuous, all_contrasts
mod <- glm(
response ~ stage + grade + trt,
gtsummary::trial,
family = binomial,
contrasts = list(
stage = contr.sum,
grade = contr.helmert,
trt = contr.poly
)
)
mod |>
tbl_regression(exponentiate = TRUE, add_pairwise_contrasts = TRUE) |>
as_kable()
Created on 2022-11-23 with reprex v2.0.2 |
@larmarange that is great! The contrast I looked at was the one from ordered factor variables: library(broom.helpers)
mod <- glm(response ~ factor(stage, ordered = TRUE) + trt, gtsummary::trial, family = binomial)
mod %>%
tidy_and_attach(exponentiate = TRUE) %>%
tidy_add_pairwise_contrasts() %>%
dplyr::select(term, variable, var_class, var_type, contrasts, contrasts_type, estimate) %>%
knitr::kable()
Created on 2022-11-23 with reprex v2.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦁
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #192 +/- ##
==========================================
- Coverage 98.03% 97.80% -0.24%
==========================================
Files 38 40 +2
Lines 1785 1870 +85
==========================================
+ Hits 1750 1829 +79
- Misses 35 41 +6
|