library("curesurv")
library("survival")
# Net survival setting
# Mixture cure model with Weibull function for the uncured patients survival:
# no covariate
theta_init2 <- rep(0, 3)
theta_lower2 <- c(-Inf,-Inf,-Inf)
theta_upper2 <- c(Inf, Inf, Inf)
fit_m0_ml <- curesurv(Surv(time_obs, event) ~ 1 | 1,
pophaz = "ehazard",
cumpophaz = "cumehazard",
model = "mixture", dist = "weib",
data = testiscancer,
init = list(theta_init = theta_init2,
theta_lower = theta_lower2,
theta_upper = theta_upper2),
method_opt = "L-BFGS-B")
fit_m0_ml
# Mixture cure model with Weibull function for the uncured patients survival:
#standardized age as covariate
fit_m2_ml <- curesurv(Surv(time_obs, event) ~ age_cr | age_cr,
pophaz = "ehazard",
cumpophaz = "cumehazard",
model = "mixture", dist = "weib",
data = testiscancer,
method_opt = "L-BFGS-B")
fit_m2_ml
## Non mixture cure model
### TNEH Null model
#### loglinear effect of covariates on time-to-null excess hazard
theta_init2 <- rep(0, 3)
theta_lower2 <- c(-Inf,-Inf,-Inf)
theta_upper2 <- c(Inf, Inf, Inf)
fit_m0_mult_tneh <- curesurv(Surv(time_obs, event) ~ 1,
pophaz = "ehazard",
cumpophaz = "cumehazard",
model = "nmixture",
dist = "tneh", link_tau = "loglinear",
data = testiscancer,
init = list(theta_init = theta_init2,
theta_lower = theta_lower2,
theta_upper = theta_upper2),
method_opt = "L-BFGS-B")
fit_m0_mult_tneh
#### Additive parametrization
theta_init2 <- c(1, 6, 6)
theta_lower2 <- c(0,1,0)
theta_upper2 <- c(Inf, Inf, Inf)
fit_m0_ad_tneh <- curesurv(Surv(time_obs, event) ~ 1,
pophaz = "ehazard",
cumpophaz = "cumehazard",
model = "nmixture",
dist = "tneh", link_tau = "linear",
data = testiscancer,
init = list(theta_init = theta_init2,
theta_lower = theta_lower2,
theta_upper = theta_upper2),
method_opt = "L-BFGS-B")
fit_m0_ad_tneh
#### Additive parametrization, with covariates
fit_m1_ad_tneh <- curesurv(Surv(time_obs, event) ~ z_alpha(age_cr) +
z_tau(age_cr),
pophaz = "ehazard",
cumpophaz = "cumehazard",
model = "nmixture",
dist = "tneh", link_tau = "linear",
data = testiscancer,
method_opt = "L-BFGS-B")
fit_m1_ad_tneh
Run the code above in your browser using DataLab