Git Product home page Git Product logo

propensity-score-weighting's Introduction

Confounding Adjustment with Propensity Score Weighting

Project Page

Markdown Link

Overview

Matching is a class of observational study methods where each treatment unit in a study is linked to one or more control units. In the context of a "quasi" or "natural" experiment (i.e. in the absence of randomization), matching helps to reduce the influence of covariate bias by creating an artificial control group that is comparable in measured features to the original treatment group.

Researchers face two common issues when working with a matched sample: first, distributions of key covariates might still be imbalanced after matching, and second, matching discards large amounts of data in an effort to obtain similar groups.

Weighting by the propensity score is one workaround. Using weighting, researchers can obtain better balance on key covariates and retain all observations from the original sample. Such weighting schemes are intimately tied to the survey sampling literature, both in their technical foundations and general limitations.

Using the population of third grade public school classrooms in New York City, we identify the treatment effect of inclusion on total attendance with a propensity score model:

# propensity score model
m_ps<- glm(treatment ~ PercentBlack + PercentSWD + PercentPoverty + TotalEnrollment +
             ENI, family = binomial(), data = working_data)
summary(m_ps)

Balance in the propensity score is diagnosed using the cobalt package

#Checking balance before and after matching:
## Call
##  matchit(formula = treatment ~ ENI + PercentBlack + PercentSWD + 
##     TotalEnrollment + PercentPoverty, data = working_data, method = "nearest", 
##     caliper = 0.25, ratio = 4, family = "binomial")
## 
## Balance Measures
##                     Type Diff.Adj    M.Threshold
## distance        Distance   0.0595 Balanced, <0.1
## ENI              Contin.  -0.0445 Balanced, <0.1
## PercentBlack     Contin.   0.0058 Balanced, <0.1
## PercentSWD       Contin.   0.0148 Balanced, <0.1
## TotalEnrollment  Contin.  -0.0661 Balanced, <0.1
## PercentPoverty   Contin.  -0.0328 Balanced, <0.1
## 
## Balance tally for mean differences
##                    count
## Balanced, <0.1         6
## Not Balanced, >0.1     0
## 
## Variable with the greatest mean difference
##         Variable Diff.Adj    M.Threshold
##  TotalEnrollment  -0.0661 Balanced, <0.1
## 
## Sample sizes
##                      Control Treated
## All                   623.       147
## Matched (ESS)         177.34     102
## Matched (Unweighted)  262.       102
## Unmatched             361.        45

IPTW and SW weights can be hard-coded, or assigned using the PSweight package:

working_data$treatment_identifier <- ifelse(working_data$treatment == 1, "inclusion", "non-inclusion")
working_data$iptw <- ifelse(working_data$treatment_identifier == 'inclusion', 1/(working_data$propensity_score),
                            1/(1-working_data$propensity_score))

#stabilized weights
working_data$stable.iptw <- ifelse(working_data$treatment_identifier == 'inclusion',
                                   (mean(working_data$propensity_score))/working_data$propensity_score,
                                   mean(1-working_data$propensity_score)/(1-working_data$propensity_score))

## Weighted Data, using the survey design package
working_data_weighted <- svydesign(ids = ~1, data= working_data, weights= working_data$iptw)
## balance of each in the unweighted sample
data<- working_data_weighted$variables
mod4 <- lm(AllStudents_PA ~ treatment, weights = data$iptw, data = data)

Citations

Ho, D. E., Imai, K., King, G., & Stuart, E. A. (2011). MatchIt: Nonparametric Preprocessing for Parametric Causal Inference. Journal of Statistical Software, 42(8). doi:10.18637/jss.v042.i08

Li, Fan, Laine E Thomas, and Fan Li. 2019. “Addressing Extreme Propensity Scores via the Overlap Weights.” American Journal of Epidemiology 188 (1): 250–57. https://doi.org/10.1093/aje/kwy201.

propensity-score-weighting's People

Contributors

katjanewilson avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.