# NOT RUN {
# Generate some data (for more details type ?penPHcure.simulate in your console)
set.seed(12) # For reproducibility
data <- penPHcure.simulate(N=250)
# 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)
# Use the predict method to obtain the probabilities for the fitted model
pred.fit <- predict(fit,data)
# Use the predict method to make prediction for new observations.
# For example, two individuals censored at time 0.5 and 1.2, respectively,
# and all cavariates equal to 1.
newdata <- data.frame(tstart=c(0,0),tstop=c(0.5,1.2),status=c(0,0),
z.1=c(1,1),z.2=c(1,1),z.3=c(1,1),z.4=c(1,1),
x.1=c(1,1),x.2=c(1,1),x.3=c(1,1),x.4=c(1,1))
pred.fit.newdata <- predict(fit,newdata)
# The probabilities to be susceptible are:
pred.fit.newdata$CURE
# [1] 0.6761677 0.6761677
# The survival probabilities (conditional on being susceptible) are:
pred.fit.newdata$SURV
# [1] 0.5591570 0.1379086
# }
Run the code above in your browser using DataLab