# NOT RUN {
# Generate some data (for more details type ?penPHcure.simulate in your console)
data <- penPHcure.simulate()
### Standard PH cure model
# Fit standard cure model (without inference)
fit <- penPHcure(Surv(time = tstart,time2 = tstop,
event = status) ~ z.1 + z.2 + z.3 + z.4,
cureform = ~ x.1 + x.2 + x.3 + x.4,data = data)
# The returned PHcure.object has methods summary and predict,
# for more details type ?summary.PHcure or ?predict.PHcure in your console.
# Fit standard cure model (with inference)
fit2 <- penPHcure(Surv(time = tstart,time2 = tstop,
event = status) ~ z.1 + z.2 + z.3 + z.4,
cureform = ~ x.1 + x.2 + x.3 + x.4,data = data,
inference = TRUE)
# The returned PHcure.object has methods summary and predict,
# for more details type ?summary.PHcure or ?predict.PHcure in your console.
### Tune penalized cure model with SCAD penalties
# First define the grid of possible values for the tuning parameters.
pen.tuneGrid <- list(CURE = list(lambda = exp(seq(-7,-2,length.out = 10)),
a = 3.7),
SURV = list(lambda = exp(seq(-7,-2,length.out = 10)),
a = 3.7))
# Tune the penalty parameters.
tuneSCAD <- penPHcure(Surv(time = tstart,time2 = tstop,
event = status) ~ z.1 + z.2 + z.3 + z.4,
cureform = ~ x.1 + x.2 + x.3 + x.4,
data = data,pen.type = "SCAD",
pen.tuneGrid = pen.tuneGrid)
# The returned penPHcure.object has methods summary and predict, for more
# details type ?summary.penPHcure or ?predict.penPHcure in your console.
### Tune penalized cure model with LASSO penalties
# First define the grid of possible values for the tuning parameters.
pen.tuneGrid <- list(CURE = list(lambda = exp(seq(-7,-2,length.out = 10))),
SURV = list(lambda = exp(seq(-7,-2,length.out = 10))))
# Tune the penalty parameters.
tuneLASSO <- penPHcure(Surv(time = tstart,time2 = tstop,
event = status) ~ z.1 + z.2 + z.3 + z.4,
cureform = ~ x.1 + x.2 + x.3 + x.4,
data = data,pen.type = "LASSO",
pen.tuneGrid = pen.tuneGrid)
# The returned penPHcure.object has methods summary and predict, for more
# details type ?summary.penPHcure or ?predict.penPHcure in your console.
# }
Run the code above in your browser using DataLab