0

My analysis focuses on causal inference. I am using the inverse of the propensity scores to form weights (Propensity score is the probability of receiving a treatment (or intervention) given a set of covariates). My question is, does anyone know how I do do the balance assessment for covariates before and after weighting? I know there are packages out there that may do this, but I want to write it by hand not by using packages. Here is an example:

X1<-c(1,1,1,0,0,1) #Covariate
X2<c(0,1,1,0,1,0)  #Covariate
X3<-c(1,0,1,1,1,0) #Treatment
X4<- c(1,0,1,1,0,0) #Outcome

data<-data.frame(X1,X2,X3,X4)

model<- glm(X3~X1+X2, family= "binomial", data=subset(data, X3==1))
propensity_score<- predict(p, newdata=data, type="response")
weights<- 1/propensity_score

The is to see if the covariates have a balance after weighting with the inverse of the propensity score (I know the general idea but am not familiar with the theory behind it)

Aura
  • 49
  • 7
  • Examine the standardized mean differences of covariates stratified by treatment groups. I do this using the TableOne package. See the various twang vignettes for visualizations using the plot function. This will be a lot of work to program from scratch. – Bill O'Brien Jul 29 '21 at 19:58
  • Note that IPTWs are *not* simply the reciprocal of the propensity score, but the reciprocal of the probability of receiving the treatment that was actually received. See Peter Austin's 2015 paper for best practices. – Bill O'Brien Jul 29 '21 at 20:02
  • Great comments from Bill O'Brien, however, this question is off topic in this forum since it's not a specific programming question. Please try stats.stackexchange.com for followups. – Robert Dodier Jul 29 '21 at 20:30
  • Take a look at the vignette for the `cobalt` package, which does balance assessment. – Noah Jul 30 '21 at 06:40
  • @BillO'Brien Thank you Bill! Im somewhat new to R and therefor using packages that are "trustable" is something I should think of whenever I want to pick one. Is there a specific cut point in terms of how much difference is allowed for SMD? – Aura Jul 30 '21 at 14:29
  • @Noah Thanks! I will! – Aura Jul 30 '21 at 14:30
  • The arbitrary cutoff point is usually <0.2 to be considered balanced, at least in the epi literature. In terms of trustworthiness of packages, the author of TableOne is a brilliant physician/researcher whom I've met a couple times, and twang was developed at the RAND corporation. Also, see Elizabeth Stuart's 2010 paper where she found GBM outperformed other methods in estimating the PS. – Bill O'Brien Jul 30 '21 at 15:01
  • @BillO'Brien Many thanks! – Aura Jul 30 '21 at 17:04

0 Answers0