# NOT RUN {
# load required packages
library(NNMIS)
library(survival)
# load data set - stanford2 in package 'survival'
data("stanford2")
head(stanford2)
attach(stanford2)
# performance multiple imputation on missing covariate t5
imp.dat <- NNMIS(t5, xa=age, xb=age, time=time, event=status, Seed = 2016, mc.core=1)
# check imputation results
head(imp.dat$dat.NNMI)
# this program can impute survival times for censored observations based on
# the imputed missing covariate values
# imp.dat <- NNMIS(t5, xa=age, xb=age, time=time, event=status, imputeCT=TRUE, Seed = 2016)
# check imputation results
# head(imp.dat$dat.NNMI) # imputed missing covariate values
# head(imp.dat$dat.T.NNMI) # imputed survival times
# head(imp.dat$dat.Id.NNMI) # censoring indicator
# }
Run the code above in your browser using DataLab