Skip to contents

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.

Usage

do_kpm(df, condition_col = "experimental_condition", model_fit = "total")

Arguments

df

data set with do_idx added by add_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.3373984 0.4019727 0.2831975     total
#> 4 2 0.3373984 0.4019727 0.2831975     total
#> 5 2 0.3252033 0.3893417 0.2716307     total
#> 6 3 0.3252033 0.3893417 0.2716307     total