mixture_cure() fits a mixture cure model, in which some subjects will never have the event.
A subject is uncured (susceptible) with probability \(\pi(z) = \mathrm{expit}(z^\top
\gamma)\), the incidence model, and the uncured follow a proportional hazards model,
\(S_u(t \mid x) = S_0(t)^{\exp(x^\top \beta)}\), the latency model. The population survival
is
$$S(t \mid x, z) = 1 - \pi(z) + \pi(z) S_u(t \mid x),$$
which levels off at the cured fraction \(1 - \pi(z)\) rather than dropping to 0.
Usage
mixture_cure(
formula,
cure,
data,
weights,
subset,
na.action = stats::na.omit,
max_iter = 50,
tol = 1e-07,
n_boot = 100,
conf_level = 0.95
)Arguments
- formula
A formula with a right-censored
Surv()response on the left and the latency covariates on the right, such asSurv(time, status) ~ treatment. Factors are coded with treatment contrasts. The latency model has no intercept (the baseline survival takes its place).- cure
A one-sided formula with the incidence covariates, such as
~ treatment. The incidence model always has an intercept, and~ 1gives one cured fraction for everyone.- data
A data frame holding the variables in
formulaandcure.- weights
Optional case weights, a column of
dataor a numeric vector. They weight the incidence and latency fits and the baseline survival, so whole-number weights act as copies.- subset
An optional expression selecting the rows of
datato use.- na.action
What to do with rows that have missing values in either formula. The default drops them.
- max_iter
The largest number of EM iterations. The default is
50.- tol
The convergence tolerance on the summed squared changes. The default is
1e-7.- n_boot
The number of bootstrap resamples for the standard errors. The default is
100.NULLgives none, and the standard errors areNA.- conf_level
The confidence level, between 0 and 1. The default is
0.95.
Value
A mixture_cure object. Use coef() or as.data.frame() for the coefficients of
the two models and predict() for the probability of being uncured and the survival curves.
The object also holds cure_coefficients, latency_coefficients, baseline (a data frame
of the baseline survival of the uncured, time and survival, at the event times),
iterations, converged, n, n_event, and with n_boot, boot (the coefficients of
each resample, one row each).
Details
The model is fit by the EM algorithm. Each step finds the probability \(w_i\) that a subject
is uncured (1 for an event, and for a censored subject \(\pi S_u / (1 - \pi + \pi S_u)\)).
Then it refits the logistic incidence model to the \(w_i\), the Cox latency model with
\(\log w_i\) as an offset (Breslow ties), and the Breslow baseline survival with the
\(w_i\) in the risk sets. The baseline is 0 after the last event time, so subjects censored
later are taken as cured. The steps stop when the summed squared changes in \(\gamma\),
\(\beta\), and the baseline survival at each subject's time fall to tol or below.
The model has no closed-form standard errors. They come from refitting to n_boot resamples,
drawn separately from the events and the censored rows so that each resample keeps the
number of events. The resamples use R's random number generator (use set.seed() to make
them reproducible).
Examples
melanoma <- data.frame(
time = c(0.3, 5.6, 5.6, 1.5, 6.4, 0.8, 6.7, 3.3, 0.6, 0.7, 3.6, 7.4, 1.8, 1.1, 1, 4.3, 3.7, 3,
1, 2.2, 1.1, 7.7, 5.4, 3.7, 1.4, 0.7, 8, 1.9, 2.2, 8, 1.2, 4.2, 5.6, 1.9, 0.2, 7.7, 0.5, 0.1,
1.1, 7.1),
status = c(1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0,
1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0),
treatment = rep(c(0, 1), times = 20)
)
# Bootstrap standard errors, from resamples drawn with R's random number generator
set.seed(1)
fit <- mixture_cure(Surv(time, status) ~ treatment, cure = ~ treatment, data = melanoma)
fit
#> <mixture_cure> Surv(time, status) ~ treatment, cure = ~treatment
#> n = 40, events = 21, EM iterations = 6, converged = yes, bootstrap resamples = 100
#>
#> Incidence (log odds of being uncured):
#> estimate std_error statistic p_value
#> (Intercept) 1.003 0.4812 2.085 0.03707
#> treatment -1.497 0.7996 -1.872 0.06115
#>
#> Latency (log hazard ratios among the uncured):
#> estimate std_error statistic p_value
#> treatment 0.2687 0.6022 0.4461 0.6555
# The probability of being uncured, and the survival curves, of each group
groups <- data.frame(treatment = c(0, 1))
predict(fit, newdata = groups, type = "uncured")
#> [1] 0.7316904 0.3789641
predict(fit, newdata = groups, type = "survival", times = c(1, 3, 6))
#> subject time estimate
#> 1 1 1 0.7326995
#> 2 1 3 0.4297285
#> 3 1 6 0.2683096
#> 4 2 1 0.8301080
#> 5 2 3 0.6735063
#> 6 2 6 0.6210359