Sign in

Propensity Score Matching: R

Since I became rather frustrated with my thesis and the whole process of propensity score matching… I thought, why not write about this so someone in the future could be less frustrated by the confusing amount of information out there!

But first, a picture to calm everyone and me down 😃

Photo by Tj Holowaychuk on Unsplash

First, is to understand why do we even use propensity matching? In this article, the author did a great job illustrating the example and rationale 👍

Then, one can move onto the R programme (package: Matchit or Matching) to actually see a code example of R-perspective. They both have similar functions, I personally prefer Matchit for the abundance of materials that uses it. I will not go into the details of various matching types/methods because they are case-dependent, plus I am no expert on this 😣

Matching: (link)

As pointed out, matching emphasises a lot on “assessing the balance”, in other words, how to know whether you have a “good match” compared to “not-matching”. The article below is quite clear on this, and I would just highlight the love plot section which is straightforward — push the white circles into the left-hand bounded line (see below).

Not such a good match, black dots improved little from the white dots — my thesis
Good match since most black dots are within the left-hand side (behind the black line) — my thesis

Lastly, one should be able to estimate the treatment effects.

If one prefers to watch a lengthy video, this is one of the most comprehensive findings of the video!

Anyways, hope this might help someone in need… I hope to be able to write up my thesis as well!

R-code for starting (just install these before starting)

install.packages(“writexl”)
library(“writexl”)

install.packages(“MatchIt”)
library(MatchIt)

library(lmtest) #coeftest
library(sandwich) #vcovCL
library(lfe)

install.packages(“optimbase”)
library(optimbase)

library(ggplot2)
library(dplyr)

library(readxl)

install.packages(“optmatch”)
library(optmatch)

install.packages(“Matching”)
library(Matching)