# \donttest{
# Generate data with missing values
compt <- generate.compt(n = 500, beta1 = c(1,1,-1), beta2 = c(2, 2, -2),
phi= c(-1,-1,-0.5), gamma = c(1,1,1,-1), seed = 112358)
# Impute
imputed <- new.smcfcs.compt(data = compt,
smformula = c("Surv(time, delta==1)~X1 +X2+X3", "Surv(time, delta==2)~X1 +X2+X3"),
method = c("","", "norm","logreg",""),m = 10, rjlimit = 10000)
# Fit a Cox regression on each imputed dataset, then produce the final estimates using Rubin's rule.
require(mitools)
library(survival)
imputed.fit <- with(imputationList(imputed), expr = coxph(Surv(time, delta==1) ~ X1+X2+X3))
summary(MIcombine(imputed.fit))# }
#' @author Qinghua Lian \email{qlian@mcw.edu}
Run the code above in your browser using DataLab