Fits each distribution named in dists to a pseudo-individual patient
data (pseudo-IPD) data frame using flexsurvreg with
observation weights. The resulting named list is designed to be passed
directly to extract_ic and blend_survival.
Usage
fit_models(
ipd,
dists = c("exp", "weibull", "gompertz", "llogis", "lnorm", "gamma")
)Arguments
- ipd
A tibble / data frame with at least three columns:
timeEvent or censoring time (numeric, > 0).
eventEvent indicator (1 = event, 0 = censored).
weightObservation weight (non-negative numeric).
Typically the output of
prep_ipdwith the first row (time = 0) removed.- dists
Character vector of distribution names accepted by
flexsurvreg. Defaults to the six-distribution set used throughout seerSurv:c("exp", "weibull", "gompertz", "llogis", "lnorm", "gamma").
Value
A named list of flexsurvreg objects, one per distribution.
Names match the corresponding element of dists.
Details
The ipd data frame should have the first row (time = 0) removed
before calling this function because flexsurvreg requires strictly
positive event times. A common idiom is:
ipd <- prep_ipd(time_vec, surv_vec)
mods <- fit_models(ipd[-1, ])