Thank you very much for your attetion!
I am working on an observation study with time-to-event data. The data has multiple covariates say V1-V5. I want to evaluate the treatment effect, so I used IPTW (weightit package) to balance V1-V5. Balance was achieved between treatment group after IPTW. However, the KM curve and log-rank P doesn't quite match, which confused me a lot.
Below is how I perform the analysis:
- I first evaluate the treatment effect without balancing. I draw the KM curve and calculated the log-rank p value, I found the curve overlap each other and P is not significant
library(survival)
library(survminer)
fit_surv <- survfit(Surv(time, event) ~ treat, data = data)
ggsurvplot(fit_surv, data = data, pval = T, pval.method = T)
2. Then I performed IPTW weighting using WeightIt package, again, I draw the KM curve and calculated the log-rank p value. However, I found the curve well-separated to each other but P remain unchanged!
library(WeightIt)
W.out <- weightit(treat ~ V1 + V2 + V3 + V4 + V5,
data = data, estimand = "ATT", method = "ebal")
data$weight <- W.out$weights
fit_surv <- survfit(Surv(time, event) ~ treat, data = data, weights = data$weight)
ggsurvplot(fit_surv, data = data, pval = T, pval.method = T)
Why a separated KM curve yield exact the same P value? I'm afraid of using the wrong test method.
When analysing weighted samples in a time-to-event data, what is the correct way of testing the survival difference?
Should I use survival::coxph(weight = ...) instead?
Any suggestions and comments are highly welcome!
