Search code examples
rstatisticsregressionstatapropensity-score-matching

Calculating Average Treatment Effect on the Treated (ATET/ATT) with propensity score


I am trying to calculate the Average Treatment Effect on the Treated using a propensity score. I am using the data to estimate whether a mother smoking during pregnancy affects birth weight.

The data includes a column with birthweight (dbrwt), a column with smoking status (tobacco01), and columns with several covariates.

I have calculated the Average Treatment Effect (ATE) as follows:

model1 <- lm(dbrwt ~ tobacco01, data = dfc, weights = weight)

The "weight" object includes the propensity scores generated by regressing smoking status on several other covariates.

Now that I have calculated the ATE, I am trying to find a way to calculate the Average Treatment Effect on the Treated (ATET). Ideally, I would be able to do this by modifying the above formula. In Stata, there is a simple "atet" command, so I was wondering if there is anything comparable in R. I have not found anything comparable when I've searched, particularly when I specify that I want to include propensity scores.

I am also open to doing this manually. The ATE is the average of the slope over the entire population (aka the coefficient on the tobacco01 variable above). The ATET is the average of the slope over the subset of the population for mothers who smoked during pregnancy. It is essentially asking: what would you expect the coefficient to be for mothers in the smoking population had they not smoked?


Solution

  • You can avoid using packages by applying your statistical knowledge.

    The propensity score (ps) is most likely not yet the weights for your weighted ATE-regression. You should calculate the weights using the appropriate formulae (see e.g. Morgan and Winship 2015, Chapter 7).

    # ATE
    dfc$w.ate <- with(dfc, ifelse(tobacco01 == 1, 1 / ps, 1 / (1 - ps)))
    
    ate <- lm(dbrwt ~ tobacco01, data=dfc, weights=w.ate)
    coef(ate)
    # (Intercept)   tobacco01 
    #   3817.6932   -178.0539 
    

    There's also a formula for the weighted ATT-regression.

    dfc$w.att <- with(dfc, ifelse(tobacco01 == 1, 1, ps / (1 - ps)))
    
    att <- lm(dbrwt ~ tobacco01, data=dfc, weights=w.att)
    coef(att)
    # (Intercept)   tobacco01 
    #   3843.0671   -334.1448 
    

    Toy data:

    set.seed(42)
    n <- 1e3
    dfc <- data.frame(dbrwt=rnorm(n, 3500, 500), tobacco01=rbinom(n, 1, .1), ps=runif(n))