# \donttest{
icf <- icfit(Surv(left, right, type='interval2') ~ period + gender + age, data=drugusers)
pred_icf <- predict(icf)
plot(pred_icf)
library(ggplot2)
plot(icf) + xlim(0, 200) + ylim(0, 0.05)
ndata <- drugusers[1:4, ]
pred_nd_icf <- predict(icf, newdata=ndata)
plot(pred_nd_icf) # plot all four
plot(pred_nd_icf[[2]]) # plot only the second
plot(pred_nd_icf, type = "cumhazard") # plot four cumulative hazard curves
plot(pred_nd_icf[[3]], type = "prob", ylim = c(0, 1)) # plot probability curve for nr 3
plot(pred_nd_icf[[4]], type = "surv", ylim = c(0, 1)) # plot survival curve for nr 4
# }
Run the code above in your browser using DataLab