## Fit a promotion time cure model on malignant melanoma data
data(melanoma)
medthick <- median(melanoma$thickness)
# Kaplan-Meier estimate to check the existence of a plateau
KapMeier <- survfit(Surv(time,status) ~ 1, data = melanoma)
plot(KapMeier, mark.time = TRUE, mark = 4, xlab = "Time (in years)")
# Fit with curelps
fit <- curelps(Surv(time , status) ~ lt(thickness + ulcer) +
st(thickness + ulcer), data = melanoma, K = 40)
fit
# Cure prediction for median thickness and absence of ulceration
curelps.extract(fit, time = c(2, 4 ,6, 8), curvetype = "probacure",
cred.int = 0.90, covar.profile = c(medthick, 0, medthick, 0))
# Plot of baseline and population survival functions
opar <- par(no.readonly = TRUE)
par(mfrow = c(1, 2))
# Baseline survival
plot(fit, curvetype = "baseline", plot.cred = FALSE, ylim = c(0,1))
# Population survival
plot(fit, curvetype = "population", covar.profile = c(medthick, 0, medthick, 0),
plot.cred = FALSE, ylim = c(0,1))
par(opar)
Run the code above in your browser using DataLab