# NOT RUN {
# }
# NOT RUN {
library(missDeaths)
library(cmprsk)
data(slopop)
data(observed)
D = md.D(age=observed$age*365.2425, sex=observed$sex, year=(observed$year - 1970)*365.2425)
np = md.survnp(observed$time*365.2425, observed$status, observed$maxtime*365.2425, D, slopop)
#calculate net survival at 3 and 9 years
w = list(list(time=np$time, est=np$surv.net, var=(np$std.err.net)^2))
timepoints(w, times=c(3,9)*365.2425)
#plot the net and event free survival curves
plot(np$time, np$surv.net)
plot(np$time, np$surv.efs)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab