I am currently trying to perform some IPTW adjustment in the context of Cox Regression models.
I was interested in expanding my understanding of the differences between ATE vs. ATT estimation. I've come through this question What are some examples when the Average Treatment Effect on the Treated/Control (ATT,ATC) is more sought after than the ATE?, but wanted to expand a little further with a toy example, in which treat
is the variable representing treatment and the other all are covariates.
Here is the code:
> library(survival)
> library(WeightIt)
> library(cobalt)
> #Create toy columns for "time" and "event" to run a Cox Model
> set.seed(123)
> options(scipen=999)
> lalonde <- cbind(lalonde,
+ event = sample(c(0,1), size=614, replace=TRUE, prob=c(0.84,0.16)),
+ time = runif(614, min=10, max=365))
>
> #Base Cox model
> coxmodel <- coxph(Surv(time, event) ~ treat + age+educ+race+married+nodegree+re74+re75, data=lalonde)
> coxmodel
Call:
coxph(formula = Surv(time, event) ~ treat + age + educ + race +
married + nodegree + re74 + re75, data = lalonde)
coef exp(coef) se(coef) z p
treat -0.03587390 0.96476194 0.28913692 -0.124 0.9013
age 0.02173526 1.02197319 0.01079062 2.014 0.0440
educ 0.00365036 1.00365704 0.05442380 0.067 0.9465
racehispan 0.41862604 1.51987187 0.35729788 1.172 0.2413
racewhite 0.24639187 1.27940083 0.29143268 0.845 0.3979
married -0.22170009 0.80115560 0.25624134 -0.865 0.3869
nodegree 0.02911170 1.02953959 0.30671247 0.095 0.9244
re74 -0.00005199 0.99994801 0.00002387 -2.178 0.0294
re75 0.00005245 1.00005245 0.00003960 1.324 0.1854
Likelihood ratio test=9.77 on 9 df, p=0.3693
n= 614, number of events= 95
>
> #Calculate Weights using ATT and ATE estimands
> weight.ate <- weightit(treat ~ age+educ+race+married+nodegree+re74+re75, data=lalonde, estimand="ATE", method="ps")
> weight.att <- weightit(treat ~ age+educ+race+married+nodegree+re74+re75, data=lalonde, estimand="ATT", method="ps")
>
> #ATE and ATT IPTW models
> coxmodel.ate <- coxph(Surv(time, event) ~ treat + age+educ+race+married+nodegree+re74+re75, weights=weight.ate$weight, data=lalonde)
> coxmodel.ate
Call:
coxph(formula = Surv(time, event) ~ treat + age + educ + race +
married + nodegree + re74 + re75, data = lalonde, weights = weight.ate$weight)
coef exp(coef) se(coef) robust se z p
treat -0.02004749 0.98015212 0.15624752 0.33832525 -0.059 0.95275
age 0.01963221 1.01982619 0.00867726 0.01434404 1.369 0.17110
educ -0.09375682 0.91050415 0.04474567 0.06947575 -1.349 0.17718
racehispan 0.46512483 1.59221293 0.24029843 0.42393452 1.097 0.27257
racewhite 0.42413118 1.52826206 0.17443581 0.35277474 1.202 0.22926
married -1.24940385 0.28667565 0.21358363 0.46879585 -2.665 0.00770
nodegree -0.66912576 0.51215613 0.23867287 0.50240513 -1.332 0.18291
re74 -0.00004309 0.99995691 0.00001951 0.00003948 -1.091 0.27509
re75 0.00014058 1.00014059 0.00002614 0.00005028 2.796 0.00518
Likelihood ratio test=66.63 on 9 df, p=0.00000000006954
n= 614, number of events= 95
>
> coxmodel.att <- coxph(Surv(time, event) ~ treat + age+educ+race+married+nodegree+re74+re75, weights=weight.att$weight, data=lalonde)
> coxmodel.att
Call:
coxph(formula = Surv(time, event) ~ treat + age + educ + race +
married + nodegree + re74 + re75, data = lalonde, weights = weight.att$weight)
coef exp(coef) se(coef) robust se z p
treat 0.12932283 1.13805747 0.28171219 0.30066781 0.430 0.667
age 0.02056776 1.02078073 0.01570762 0.01799373 1.143 0.253
educ -0.04314595 0.95777159 0.08796343 0.09308908 -0.463 0.643
racehispan 0.48004895 1.61615351 0.50506011 0.40841181 1.175 0.240
racewhite 0.34355493 1.40995097 0.44556116 0.39978515 0.859 0.390
married -0.59944595 0.54911579 0.45169368 0.55615322 -1.078 0.281
nodegree -0.24558174 0.78224934 0.43330653 0.50702412 -0.484 0.628
re74 -0.00002932 0.99997068 0.00004409 0.00003812 -0.769 0.442
re75 0.00006454 1.00006454 0.00005850 0.00007373 0.875 0.381
Likelihood ratio test=5.19 on 9 df, p=0.8171
n= 614, number of events= 95
Basically, we can see that the effect of treat
is slightly different between the two models (ATE and ATT) and obviously when compared with the standard, unweighted Cox Model. Apart from the statistical significance, I have two questions:
- Can I use the weight generated through the
WeightIt
package directly into acoxph
call to run an IPTW analysis? I did not find any worked example on this on the vignette, so just to be sure that I am running correctly. - What is the right interpretation of the coefficients found for ATT and ATE models? Given the aforementioned question, I am currently interpreting the coefficient for ATE model as "what would be the effect when applying
treat
over the whole population of analysis", while the ATT one as "what would be the effect when withholdingtreat
from those currently treated in the population`, but I am not sure that this is the correct one.