r - Combining Imputed Data After Cox Model -
i want impute missing data in table, , run cox model on imputed table.
i can imputation run on data, , cox model run on imputed data, don't understand how view cox output data set, of values imputed (i.e. need hazard ratios , p values in output).
the commands are:
>library("mice") >table <-read.table("testtable",stringsasfactors=true,header=true)
then make sure relevent variables factors (e.g. cohort can 0 or 1, make sure these seen different categories).
> table$cohort <-as.factor(table$cohort) > table$sex <-as.factor(table$sex) > table$type <-as.factor(table$type) > table$grade <-as.factor(table$grade) > table$comorbidity <-as.factor(table$comorbidity) > table$snp1 <-as.factor(table$snp1) > table$snp2 <-as.factor(table$snp2)
then relevel factors make cox model easier intepret later on:
>table$snp1 <-relevel(table$snp1,"wt") >table$snp2 <-relevel(table$snp2,"wt") >table$grade <-relevel(table$grade,"1") >table$comorbidity <-relevel(table$comorbidity,"1")
then imputed data: polyreg categorical data more 2 levels, logreg factors 3 levels.
imp <-mice(table,maxit=5,seed=12345,me=c("","","","","","","","","","","","polyreg","polyreg","logreg","logreg"))
then, ran cox model run on imputed data set:
library("survival") table$survival <-as.numeric(table$survival) cox_with_imp <- with(imp,coxph(surv(survival,event)~strata(cohort) + strata(grade) + strata(comorbidity) + factor(snp1) + factor(snp2)))
the output 5 cox model analyses. i'm having trouble pooling information together. when type "pool(cox_with_imp)", gives me statistics. want "pooled" table hr , p values.
would know command type pool 5 imputed cox models 1 consensus cox model hr , p values.
thanks.
you cannot combine these p-values directly valid inferences, because under null hypothesis these p-values uniformly distributed , rubin’s combining rules require normal distribution or t-distribution.
Comments
Post a Comment