# Propensity score matching example

This course aims to answer that question and more! Over a period of 5 weeks, you will learn how causal effects are defined, what assumptions about your data and models are necessary, and how to implement and interpret some popular statistical methods. Learners will have the opportunity to apply these methods to example data in R free statistical software environment. At the end of the course, learners should be able to: 1. Define causal effects using potential outcomes 2. Describe the difference between association and causation 3.

Express assumptions with causal graphs 4. Implement several types of causal inference methods e. Identify which causal assumptions are necessary for each type of statistical method So join us Works best on double speed from settings menu of each video.

Content is delivered in clear and relatable manner using interesting real world examples. This course is quite useful for me to get quick understanding of the causality and causal inference in epidemiologic studies.

An overview of matching methods for estimating causal effects is presented, including matching directly on confounders and matching on the propensity score. The ideas are illustrated with data analysis examples in R.

Observational studies Overview of matching Matching directly on confounders Greedy nearest-neighbor matching The PSMATCH procedure reduces the effects of confounding in nonrandomized trials or observational studies where the subjects are not randomly assigned to the treatment and control groups. The PSMATCH procedure computes propensity scores, which estimate the probability that a subject is assigned to treatment given a set of pretreatment baseline covariates.

The following methods for using the propensity scores to adjust the data for valid estimation of treatment effect are available:. The PSMATCH procedures saves propensity scores and weights in an output data set that contains a sample that has been adjusted either by weighting, stratification, or matching. If the sample is stratified, you can save the strata identification in the output data set. If the sample is matched, you can save the matching identification in the output data set.

The following methods for using the propensity scores to adjust the data for valid estimation of treatment effect are available: Inverse probability of treatment weighting and weighting by the odds.

Stratification of observations that have similar propensity scores. In a subsequent outcome analysis, the treatment effect can be estimated within each stratum, and the estimates can be combined across strata to compute an average treatment effect.

Matching treated unit with one or more control units that have a similar value of the propensity score. Methods of matching include: fixed ratio matching variable ratio matching full matching Provides various plots for assessing balance.

Included plots are: cloud plots, which are scatter plots in which the points are jittered to prevent overplotting box plots for continuous variables bar charts for classification variables a standardized differences plot that summarizes differences between the treated and control groups The PSMATCH procedures saves propensity scores and weights in an output data set that contains a sample that has been adjusted either by weighting, stratification, or matching.Propensity score methods allow investigators to estimate causal treatment effects using observational or nonrandomized data.

In this article we provide a practical illustration of the appropriate steps in conducting propensity score analyses. For illustrative purposes, we use a sample of current smokers who were discharged alive after being hospitalized with a diagnosis of acute myocardial infarction.

The exposure of interest was receipt of smoking cessation counseling prior to hospital discharge and the outcome was mortality with 3 years of hospital discharge. We illustrate the following concepts: first, how to specify the propensity score model; second, how to match treated and untreated participants on the propensity score; third, how to compare the similarity of baseline characteristics between treated and untreated participants after stratifying on the propensity score, in a sample matched on the propensity score, or in a sample weighted by the inverse probability of treatment; fourth, how to estimate the effect of treatment on outcomes when using propensity score matching, stratification on the propensity score, inverse probability of treatment weighting using the propensity score, or covariate adjustment using the propensity score.

### R Tutorial 8: Propensity Score Matching

Finally, we compare the results of the propensity score analyses with those obtained using conventional regression adjustment. Propensity score methods allow one to minimize the effects of observed confounding when estimating treatment effects using observational data.

An article to appear in a special issue on propensity score analysis to be published in Multivariate Behavioral Research describes a framework for using propensity scores to estimate causal treatment effects using observational or nonrandomized data Austin, in press-a. In the review paper, the different methods of using propensity scores to estimate treatment effects are highlighted along with a description of the steps in conducting a propensity score analysis.

The objective of the current article is to illustrate the methods described in the overview article using a single data source.

In this article, a propensity score analysis was conducted using four different propensity score methods to estimate the effect of in-patient smoking cessation counseling on mortality in patients hospitalized with a heart attack.

The results from the propensity score analyses are compared with those obtained using conventional regression adjustment. The data consisted of patients hospitalized with acute myocardial infarction AMI or heart attack at acute care hospitals in Ontario, Canada, between April 1,and March 31, Data on patient history, cardiac risk factors, comorbid conditions and vascular history, vital signs, and laboratory tests were obtained by retrospective chart review by trained cardiovascular research nurses.

The sample was restricted to those patients who survived to hospital discharge and who had documented evidence of being current smokers. For the purposes of the current case study, the treatment or exposure of interest was whether the patient received in-patient smoking cessation counseling. Smokers whose counseling status could not be determined from the medical record were excluded from the current study.

Patients with missing data on important baseline clinical covariates were excluded from the sample. Patient records were linked to the Registered Persons Database using encrypted health card numbers, which allowed for determining the vital status of each patient at 3 years following hospital discharge.

For the current study, the outcome was survival to 3 years, considered as both a dichotomous and a time-to-event outcome.In a propensity score—matched cohort study published in the March 12,issue of JAMAZeng et al 1 found that prescription tramadol was associated with significantly greater 1-year mortality compared with nonsteroidal anti-inflammatory alternatives in adults with osteoarthritis.

At baseline, patients receiving tramadol were different than those who received other analgesics in terms of demographics, medical comorbidities, medications, and prior hospital resource utilization. Zeng et al 1 used propensity score matching in an effort to account for differences between groups.

Econometrics Overview. Econometrics Assignments. Introduction to Stata. Introduction to R. Introduction to SAS. Introduction to SPSS. Linear Regression. Panel Data Models. Probit and Logit Models. Bivariate Probit and Logit Models. Multinomial Probit and Logit Models. Ordered Probit and Logit Models. Limited Dependent Variable Models. Count Data Models. Survival Analysis. Spatial Econometrics. Quantile Regression. Propensity Score Matching.

Principal Component Analysis. Instrumental Variables. Seemingly Unrelated Regressions. About Econometrics Academy. Treatment evaluation is the estimation of the average effect of a program or treatment on the outcome of interest. A comparison of outcomes is made between treated and control groups. Examples include estimating the effects of a training program on job performance or the effects of a government program targeted at helping particular schools. Propensity Score Matching Example.

Propensity Score Matching in Stata. Propensity Score Matching in R.Stata Statistical Software: Release Leuven and B. Version 4. It can be loaded with the following command:. The data in cattaneo2 is a subset of data that was analysed in the following journal articles:. Almond, D.

## Balance diagnostics after propensity score matching

The costs of low birth weight, Quarterly Journal of Economics Cattaneo, M. Efficient semiparametric estimation of multi-valued treatment effects under ignorability, Journal of Econometrics, 2 The original dataset included nearlybirths. You can access the complete codebook with the command codebook after loading the data. Differences in outcomes between the treated and untreated or exposed and unexposed may be the consequence of confounding variables and not the treatment or exposure.

There are several methods for estimating a treatment effect with observational data. In this lecture series, you have been exposed not randomly to a family of methods which use the propensity score. The primary focus has been on propensity score matching.

Thomas G. NOTE 1 I reserve the right for these notes to be wrong, mistaken, or incomplete. Please feel free to provide content and comments. TABLE1: module to create "table 1" of baseline characteristics for a manuscript. Version 1. It can be loaded with the following command: webuse cattaneo2. Investigators generate a treatment schedule prior to patient enrollment.

The schedule is constructed based on the design of the study, which includes randomization in some fashion. Relationship between covariates and treatment assignment are known from study design. Usually the study is designed so that there is no relationship between treatment assignment and covariates. Relationship between covariates and treatment assignment is unknown.Because students who attend Catholic school on average are different from students who attend public school, we will use propensity score matching to get more credible causal estimates of Catholic schooling.

To get the dataset used below ecls. Here is some basic information about public and catholic school students in terms of math achievement.

Propensity score matching: an introduction

This is common in education research. This could have been calculated using the non-standardized outcome variable as follows:. The difference-in-means is statistically significant at conventional levels of confidence as is also evident from the small standard error above :.

What do you see? Take a moment to reflect on what these differences suggest for the relationship of interest that between Catholic schooling and student achievement. We estimate the propensity score by running a logit model probit also works where the outcome variable is a binary variable indicating treatment status. What covariates should you include? For the matching to give you a causal estimate in the end, you need to include any covariate that is related to both the treatment assignment and potential outcomes.

I choose just a few covariates below—they are unlikely to capture all covariates that should be included. Using this model, we can now calculate the propensity score for each student.

After estimating the propensity score, it is useful to plot histograms of the estimated propensity scores by treatment status:. A simple method for estimating the treatment effect of Catholic schooling is to restrict the sample to observations within the region of common support, and then to divide the sample within the region of common support into 5 quintiles, based on the estimated propensity score.

Within each of these 5 quintiles, we can then estimate the mean difference in student achievement by treatment status. However, most matching algorithms adopt slightly more complex methods. The method we use below is to find pairs of observations that have very similar propensity scores, but that differ in their treatment status.

We use the package MatchIt for this. To create a dataframe containing only the matched observations, use the match. Note that the final dataset is smaller than the original: it contains observations, meaning that pairs of treated and control observations were matched. Also note that the final dataset contains a variable called distancewhich is the propensity score.