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
Add support for model_get_n()
for tidycrr model objects
#143
Comments
add_n()
and add_nevent()
for tidycrr model objectsadd_nevent()
for tidycrr model objects
Dear @ddsjoberg Can you please check #144 Does it fix the problem? Would you have some other tests to check that results are as expected? library(tidycmprsk)
library(broom.helpers)
library(gtsummary)
#>
#> Attachement du package : 'gtsummary'
#> Les objets suivants sont masqués depuis 'package:broom.helpers':
#>
#> all_continuous, all_contrasts
#> L'objet suivant est masqué depuis 'package:tidycmprsk':
#>
#> trial
mod <- crr(Surv(ttdeath, death_cr) ~ age + trt, tidycmprsk::trial)
#> 11 cases omitted due to missing values
mod %>% model_get_n()
#> # A tibble: 4 x 4
#> term n_obs n_event exposure
#> <chr> <dbl> <dbl> <dbl>
#> 1 (Intercept) 189 154 3762.
#> 2 age 189 154 3762.
#> 3 trtDrug B 98 83 1888.
#> 4 trtDrug A 91 71 1874.
mod %>%
tbl_regression(exponentiate = TRUE) %>%
add_nevent() %>%
as_kable()
Created on 2022-02-01 by the reprex package (v2.0.1) |
add_nevent()
for tidycrr model objectsmodel_get_n()
for tidycrr model objects
Hmmmm I'm not sure about the results. For Coxph models, the number of events include all type of events. If I understand properly |
I have updated the PR to consider, as the number of events, only status defined by library(tidycmprsk)
library(broom.helpers)
library(gtsummary)
#>
#> Attachement du package : 'gtsummary'
#> Les objets suivants sont masqués depuis 'package:broom.helpers':
#>
#> all_continuous, all_contrasts
#> L'objet suivant est masqué depuis 'package:tidycmprsk':
#>
#> trial
mod <- crr(Surv(ttdeath, death_cr) ~ age + trt, tidycmprsk::trial)
#> 11 cases omitted due to missing values
mod %>% model_get_n()
#> # A tibble: 4 x 4
#> term n_obs n_event exposure
#> <chr> <dbl> <dbl> <dbl>
#> 1 (Intercept) 189 52 3762.
#> 2 age 189 52 3762.
#> 3 trtDrug B 98 31 1888.
#> 4 trtDrug A 91 21 1874.
mod %>%
tbl_regression(exponentiate = TRUE) %>%
add_nevent() %>%
as_kable()
Created on 2022-02-01 by the reprex package (v2.0.1) |
Side question: should we support |
Everything looks flawless! Thank you so much for adding! |
What did you have in mind? These estimates are not regression models; they are more like the KM results from I also wrote a gtsummary-like function for them and added them to the tidycmprsk package. |
Thanks for the feedback. It's merged now. No worry, I didn't look into the details of tidycuminc. If there is no need, that's OK with me. |
I can try to add this support at some time if you're in a busy season :)
The text was updated successfully, but these errors were encountered: