# NOT RUN {
# }
# NOT RUN {
library(missDeaths)
data(slopop)
data(observed)
observed$time = observed$time*365.2425
D = md.D(age=observed$age*365.2425, sex=observed$sex, year=(observed$year - 1970)*365.2425)
#fit a cox model (NOTE: estimated std error is slightly underestimated!)
md.survcox(observed, Surv(time, status) ~ age + sex + iq + elevation,
observed$maxtime*365.2425, D, slopop, iterations=4, R=1)
#multiple imputations to correct the stimated std error
md.survcox(observed, Surv(time, status) ~ age + sex + iq + elevation,
observed$maxtime*365.2425, D, slopop, iterations=4, R=50)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab