This function needs a data set with a dropout index added by add_dropout_idx()
.
The do_kpm
function performs survival analysis with Kaplan-Meier Estimation
and returns a list containing survival steps, the original data frame, and the model fit type.
The function can fit the survival model either for the entire data set or separately by a specified condition column.
Arguments
- df
data set with
do_idx
added byadd_dropout_idx()
- condition_col
character denoting the experimental conditions to model
- model_fit
character Should be either "total" for a total model or "conditions"
Value
Returns a list containing steps
(survival steps extracted from the fitted models),
d
(the original data frame), and model_fit
(the model fit type).
See also
survival::Surv()
used to fit survival object.
Examples
demo_kpm <- do_kpm(df = add_dropout_idx(dropRdemo, 3:54),
condition_col = "experimental_condition",
model_fit = "total")
head(demo_kpm$steps)
#> x y uppr lwr condition
#> 1 0 0.3821138 0.4479241 0.3259726 total
#> 2 1 0.3821138 0.4479241 0.3259726 total
#> 3 1 0.3414634 0.4061734 0.2870628 total
#> 4 2 0.3414634 0.4061734 0.2870628 total
#> 5 2 0.3292683 0.3935569 0.2754814 total
#> 6 3 0.3292683 0.3935569 0.2754814 total