'IPW-adjusted Kaplan-Meier analysis and IPW-adjusted RMST analysis after multiple imputation
I would like to do the following analyses with the dataset with missing variables. Because mice and MatchThem packages do not support pooling the results of Kaplan-Meier analysis, I try to do it manually as follows:
- Do multiple imputations using
mice. - Calculate inverse probability weights in each imputed dataset using
WeightIt. - Estimate IPW-adjusted Kaplan-Meier curves in each imputed dataset using
survfit. - Pool the results of #3 and depict the pooled IPW-adjusted KM curves.
- Calculate the difference in IPW-adjusted restricted mean survival time (the area under KM curve until the specific timepoint) according to
akm-rmst(https://github.com/s-conner/akm-rmst) within each imputed dataset. - Pool the results of #5.
- Get descriptive statistics of baseline characteristics in imputed dataset using
tbl_summaryfromgtsummarypackage.
Here are my codes
pacman::p_load(survival, survey, survminer, WeightIt, tidyverse, mice)
df # sample dataset
m <- 10 # number of imputation
dimp <- mice::mice(df, m = m, seed = 123)
for (i in 1:m) {
dcomp <- mice::complete(dimp, i) # extract imputed data
# estimate weight
wgt <- weightit(
treatment ~ age + sex + smoking,
data = dcomp, method = "ps", estimand = "ATE", stabilize = TRUE
)
# add weight and pscore to dataset
dimp <- tibble(dcomp, wgt = wgt[["weights"]], pscores = wgt[["ps"]])
assign(paste0("df", i), output) # save "i"th imputed dataset
# calculate Kaplan-Meier estimate
surv <- survival::survfit(Surv(time, event) ~ treatment, data = dimp, weight = wgt)
assign(paste0("surv", i), output) # save "i"th IPW-adjusted KM curves
}
These codes do the analyses from #1 to #3. Although I read the reference (https://stefvanbuuren.name/fimd/sec-pooling.html), I could not find how to do these analyses(#4 to #7). Can anyone give me some advice regarding #4 to #7?
I believe this is not a duplicate to any posted question so I'd appreciate any advice. Any assistance you can provide would be greatly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
