I am analyzing observational study data. My predictor variable is tg4
with 4 categories (0,1,2,3) and my response variable is dm
(0,1).
my analysis step as follow:
- I use mice package to impute missing data as follow
chi<-chi %>% mice(seed = 123, print = FALSE, m=5)
- Covariate balance assessment using standardized mean differences (SMD) (I tried to use
tableone
package) but it does not work because I have 5 imputed datasets. - calculating propensity score using multinomial logistic regression.
- calculating weight
- calculating pooled hazard ratio for all dataset
suvtime<-Surv(time=chi$time,event = chi$dm)
fit<- coxph(suvtime~tg4,data=chi, weights =weights)
Thank you for your help.
Best Answer
There is a set of packages you can use for this. The
MatchThem
package performs matching and IPW in multiply imputed datasets; you can supply it with amids
objects frommice
and it will perform the weighting in all of the imputed datasets. It calls theweightit()
function from theWeightIt
package to do the weighting. You can then use thebal.tab()
function incobalt
to assess balance on the imputed datasets. Once you have achieved balance, you can fit your outcome model using thewith()
function inMatchThem
.I recommend you 1) look at the
WeightIt
package and see its capabilities for multi-category treatments (there are many options beyond multinomial logistic regression); 2) look at theMatchThem
package for applyingWeightIt
functionality to multiply imputed datasets and estimating treatment effects pooling across the datasets; and 3) look at thecobalt
package for assessing balance generally and specifically with multiply imputed data and multi-category treatments. I am the author of all three of these packages, and they are designed to work seamlessly together specifically for this type of analysis.