class: center, middle, inverse, title-slide # Limited Dependent Variables ## Matching Models ### Jose M. Fernandez ### University of Louisville ### 2020-7-4 (updated: 2021-03-03) --- ## Propensity Score Match Propensity Score Matching (PSM) is a useful technique when using quasi-experimental or observational data (Austin, 2011; Rubin, 1983). * It helps to create a counterfactual sample (control group) when random assignment is unavailable, unfeasible, or unethical. * By using an index instead of specific covariates to match, PSM mitigates the curse of dimensionality associated with "exact match" techniques. * Along with reducing the curse of dimensionality, this technique can be used in small samples where exact matches are infrequent or non-existent --- ## Conceptual Model The model `$$y=z \gamma+X\beta+u$$` Suppose you observe an outcome variable `\(y\)`, a treatment variable `\(z\)`, and a set of covariates in matrix `\(X\)`. If the standard assumption that `\(E[Xu]=E[Zu]=0\)` holds, then we can simply use OLS to estimate the treatment effect. However, this assumption rarely holds in non-experimental settings. That is, the treatment assignment is endogenous (i.e. `\(E[Zu]\ne0\)`) --- ## Conceptual Model The model `$$y=z \gamma+X\beta+u$$` If we have an instrumental variable for `\(z\)`, then we can still use IV to estimate the treatment effect. Matching models become an option when 1. No instrument is available 2. We believe the covariates X are independent of the error term `\(E[Xu]=0\)`. --- ## Conceptual Model We can use a two step process to help solve this problem. Step 1. Use a probit or logit model to estimate `\(Pr(z=1|X)\)`. - This step allows us to estimate the likelihood that a person would receive treatment given their observable characteristics. Step 2. Use the predict probability (propensity score) from Step 1 to match people in the treatment group with people in the control group that have very similar propensity scores. - For example, if someone in the treatment group has a predicted probability of receiving treatment equal to 0.5, then we would like to match that person with someone who has a predicted probability close to 0.5, but who did not receive the treatment. --- ## PSM illustrated <img src="https://www.researchgate.net/profile/Daniel-Zaga-Szenker/publication/284189216/figure/fig1/AS:391431240863745@1470335888084/The-Common-Support-Region.png" width="75%" style="display: block; margin: auto;" /> --- ## PSM Tips * Probit/Logit may not be the best method to construct the propensity score. * Machine Learning is particularly adapt to classification problems * Consider using a classification model like Boost to obtain propensity scores --- ## Examples of Propensity Score problems * JobCorps is the largest free residential education and jobs programs. We may want to know the benefit of JobCorps on employment. However, individuals self-select into the JobCorps program. * Is there a wage penalty associated with smoking? People are not randomly assigned to be smokers. How can we estimate this affect? * Is there a benefit of attending private vs public school? Again, students are not randomly assigned to public or private schools --- ## Other types of matching Before we proceed with propensity score matching let's consider two alternatives 1. Exact Match: Here we match people in the treatment group with individuals in the control group that have identical observable characteristics (i.e. X's). * This method requires a lot of data. * The assumption is that the unobserved portion of the individual is randomly distributed. * We can average the outcome variable of the set of exact control matches and subtract that from the treatment outcome. The Law of Large numbers will give us an unbias estimate as `\(n \to \infty\)`. --- ## Other types of matching Before we proceed with propensity score matching let's consider two alternatives 2. Mahalanobis Metric Matching: Relaxes the assumption of _exact match_. Instead, it calculates the distance between observation using a multidimentional distance metric. * Requires less data than exact match. * suffers from the curse of dimensionality. * To reduce the curse of dimensionality remove X's that are more randomly distributed between groups. --- ## Mahalanobis Metric Matching The distance formula is given by `$$d(i,j)=(u-v) C^{-1} (u-v)^T$$` Let k be the number of covariates, then u is a row vector of covariate for person i (treatment) with the dimensions 1xk. Similarly, v is a row vector for person j (control). The matrix `\(C^{-1}\)` is the covariance matrix for the control group. We match every person in the treatment with a person in the control group that has the smallest `\(d(i,j)\)` It is possible that an individual from the control group who is selected as the match for a participant in the treatment group, is not close in a multidimensional space. The average distance between observations actually increases as we included more covariates (Gu & Rosenbaum, 1993; Stuart, 2010; Zhao, 2004). --- ## Propensity Score Matching In propensity score matching, we utilize the nearest-neighbor routine, which matches individuals in the treatment group with individuals in the control group who have the closest propensity score. As in the Mahalanobis Metric, we need to take care that the distance is between matches is not to great. We can impose a _caliper_ limit which states that `$$||P_i-P_j||<\epsilon$$` where `\(\epsilon=0.25*\sigma_p\)` and `\(\sigma_p\)` is the standard deviation of the propensity score metric. --- ## Advance Routines 1. You can combine PSM with Mahalanobis Metric by estimating the propensity scores and including the score as another covariate in the Mahalanobis Metric 2. Optimal Matching: This method uses propensity score match, but tries to minimize the total propensity score difference across all matches. 3. Full Matching: Is equivalent to optimal matching, but matches with replacement. That is, the same person can be used as a match in more than one pair. --- ## Which Routine should I choose? There are many choices and approaches to matching, including: - Propensity score matching. - Limited exact matching. - Full matching. - Nearest neighbor matching. - Optimal/Genetic matching. - Mahalanobis distance matching (for quantiative covariates only). - Matching with and without replacement. - One-to-one or one-to-many matching. Which matching method should you use? __Whichever one gives the best balance!__ --- class: inverse, middle, center # Propensity Match in R --- ## National Supported Work The National Supported Work (NSW) Demonstration was a federally and privately funded randomized experiment done in the 1970s to estimate the effects of a job training program for disadvantaged workers. Participants were randomly selected to participate in the training program. Both groups were followed up to determine the effect of the training on wages. Analysis of the mean differences (unbiased given randomization), was approximately $800. Lalonde (1986) used data from the Panel Survey of Income Dynamics (PSID) and the Current Population Survey (CPS) to investigate whether non-experimental methods would result in similar results to the randomized experiment. He found results ranging from 700 to 16000 dollars. --- ## PSM: Dehejia and Wahba (1999) Dehejia and Wahba (1999) later used propensity score matching to analyze the data. - Comparison groups selected by Lalonde were very dissimilar to the treated group. - By restricting the comparison group to those that were similar to the treated group, they could replicate the original NSW results. - Using the CPS data, the range of treatment effect was between $1,559 to $1,681. The experimental results for the sample was approximately $1,800. - The covariates available include: age, education level, high school degree, marital status, race, ethnicity, and earning sin 1974 and 1975. - Outcome of interest is earnings in 1978. --- ## Replication <small> Calculating the Propensity Score ```r library(MatchIt); data(lalonde) lalonde$black<- ifelse(lalonde$race=="black",1,0) lalonde$hispan <- ifelse(lalonde$race=="hispan",1,0) lalonde.formu <- treat~age + educ + black + hispan + married + nodegree + re74 + re75 glm1 <- glm(lalonde.formu, family=binomial, data=lalonde) stargazer::stargazer(glm1,type="text",single.row = TRUE) ``` ``` ## ## ============================================= ## Dependent variable: ## --------------------------- ## treat ## --------------------------------------------- ## age 0.016 (0.014) ## educ 0.161** (0.065) ## black 3.065*** (0.287) ## hispan 0.984** (0.426) ## married -0.832*** (0.290) ## nodegree 0.707** (0.338) ## re74 -0.0001** (0.00003) ## re75 0.0001 (0.00005) ## Constant -4.729*** (1.017) ## --------------------------------------------- ## Observations 614 ## Log Likelihood -243.922 ## Akaike Inf. Crit. 505.844 ## ============================================= ## Note: *p<0.1; **p<0.05; ***p<0.01 ``` </small> --- ## Replication ```r ## Mahalanobis Metric Matching m.mahal<-matchit(treat ~ age + educ + race + nodegree + married + re74 + re75, data = lalonde, distance = "glm", link = "probit", mahvars = ~ age + educ + re74 + re75, caliper = .1, ratio = 2) ## Get matched Data mahal.match<-match.data(m.mahal) ## PSM nearest neighbor ##m.nn<-matchit(lalonde.formu, data = lalonde, caliper=0.1, method ="nearest") m.nn<-matchit(lalonde.formu, data = lalonde, ratio=1, method ="nearest") nn.match<-match.data(m.nn) ``` --- ## Replication: Test for balance <small> ```r library(RItools) ## Unconditional xBalance(lalonde.formu, data = lalonde, report=c("chisquare.test")) ``` ``` ## ---Overall Test--- ## chisquare df p.value ## unstrat 238 8 6.17e-47 ## --- ## Signif. codes: 0 '***' 0.001 '** ' 0.01 '* ' 0.05 '. ' 0.1 ' ' 1 ``` ```r ## Nearest Neighbor xBalance(lalonde.formu, data = as.data.frame(nn.match), report=c("chisquare.test")) ``` ``` ## ---Overall Test--- ## chisquare df p.value ## unstrat 61 8 2.99e-10 ## --- ## Signif. codes: 0 '***' 0.001 '** ' 0.01 '* ' 0.05 '. ' 0.1 ' ' 1 ``` </small> --- ## Replication: Results </tiny> ```r reg.1<-lm(re78~treat+age+educ+nodegree+re74+re75+married+black+hispan,data=lalonde) reg.2<-lm(re78~treat+age+educ+nodegree+re74+re75+married+black+hispan,data=nn.match) reg.3<-lm(re78~treat+age+educ+nodegree+re74+re75+married+black+hispan,data=mahal.match) reg.2a<-lm(re78~treat,data=nn.match) reg.3a<-lm(re78~treat,data=mahal.match) ``` --- ## Replication: Results <tiny> <table style="text-align:center"><tr><td colspan="6" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td colspan="5"><em>Dependent variable:</em></td></tr> <tr><td></td><td colspan="5" style="border-bottom: 1px solid black"></td></tr> <tr><td style="text-align:left"></td><td colspan="5">OLS</td></tr> <tr><td style="text-align:left"></td><td>(1)</td><td>(2)</td><td>(3)</td><td>(4)</td><td>(5)</td></tr> <tr><td colspan="6" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">treat</td><td>1,548.244<sup>**</sup></td><td>894.367</td><td>1,344.936<sup>*</sup></td><td>939.144</td><td>973.326</td></tr> <tr><td style="text-align:left"></td><td>(781.279)</td><td>(730.295)</td><td>(789.780)</td><td>(819.618)</td><td>(824.285)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">age</td><td>12.978</td><td></td><td>7.804</td><td></td><td>1.025</td></tr> <tr><td style="text-align:left"></td><td>(32.489)</td><td></td><td>(42.915)</td><td></td><td>(50.615)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">educ</td><td>403.941<sup>**</sup></td><td></td><td>602.203<sup>***</sup></td><td></td><td>499.794<sup>*</sup></td></tr> <tr><td style="text-align:left"></td><td>(158.906)</td><td></td><td>(224.070)</td><td></td><td>(260.168)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">nodegree</td><td>259.817</td><td></td><td>923.284</td><td></td><td>-117.358</td></tr> <tr><td style="text-align:left"></td><td>(847.442)</td><td></td><td>(1,109.915)</td><td></td><td>(1,209.181)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">re74</td><td>0.296<sup>***</sup></td><td></td><td>0.026</td><td></td><td>0.124</td></tr> <tr><td style="text-align:left"></td><td>(0.058)</td><td></td><td>(0.103)</td><td></td><td>(0.105)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">re75</td><td>0.232<sup>**</sup></td><td></td><td>0.221</td><td></td><td>0.132</td></tr> <tr><td style="text-align:left"></td><td>(0.105)</td><td></td><td>(0.160)</td><td></td><td>(0.164)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">married</td><td>406.621</td><td></td><td>-158.255</td><td></td><td>49.151</td></tr> <tr><td style="text-align:left"></td><td>(695.472)</td><td></td><td>(986.307)</td><td></td><td>(1,087.943)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">black</td><td>-1,240.644</td><td></td><td>-469.434</td><td></td><td>-1,433.906</td></tr> <tr><td style="text-align:left"></td><td>(768.764)</td><td></td><td>(1,009.928)</td><td></td><td>(1,004.361)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">hispan</td><td>498.897</td><td></td><td>1,064.045</td><td></td><td>-309.927</td></tr> <tr><td style="text-align:left"></td><td>(941.943)</td><td></td><td>(1,300.198)</td><td></td><td>(1,426.997)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">Constant</td><td>66.515</td><td>5,454.776<sup>***</sup></td><td>-2,112.211</td><td>5,311.901<sup>***</sup></td><td>565.576</td></tr> <tr><td style="text-align:left"></td><td>(2,436.746)</td><td>(516.396)</td><td>(3,511.770)</td><td>(538.650)</td><td>(3,864.384)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td colspan="6" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">Observations</td><td>614</td><td>370</td><td>370</td><td>257</td><td>257</td></tr> <tr><td style="text-align:left">R<sup>2</sup></td><td>0.148</td><td>0.004</td><td>0.049</td><td>0.005</td><td>0.075</td></tr> <tr><td style="text-align:left">Adjusted R<sup>2</sup></td><td>0.135</td><td>0.001</td><td>0.025</td><td>0.001</td><td>0.042</td></tr> <tr><td style="text-align:left">Residual Std. Error</td><td>6,947.917 (df = 604)</td><td>7,023.750 (df = 368)</td><td>6,939.857 (df = 360)</td><td>6,508.533 (df = 255)</td><td>6,375.292 (df = 247)</td></tr> <tr><td style="text-align:left">F Statistic</td><td>11.636<sup>***</sup> (df = 9; 604)</td><td>1.500 (df = 1; 368)</td><td>2.054<sup>**</sup> (df = 9; 360)</td><td>1.313 (df = 1; 255)</td><td>2.238<sup>**</sup> (df = 9; 247)</td></tr> <tr><td colspan="6" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"><em>Note:</em></td><td colspan="5" style="text-align:right"><sup>*</sup>p<0.1; <sup>**</sup>p<0.05; <sup>***</sup>p<0.01</td></tr> </table> </tiny> --- <small> ## Replication: Matched Dataset ```r matches<-data.frame(m.nn$match.matrix) # Separate the data into treatment and control group1<-match(row.names(matches),row.names(nn.match)) group2<-match(matches[ ,],row.names(nn.match)) yT<-nn.match$re78[group1] yC<-nn.match$re78[group2] # bind matched cases matched.cases<-cbind(matches,yT,yC) # Paired T-test t.test(matched.cases$yT,matched.cases$yC,paired=TRUE) ``` ``` ## ## Paired t-test ## ## data: matched.cases$yT and matched.cases$yC ## t = 1.2512, df = 184, p-value = 0.2124 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -515.8764 2304.6114 ## sample estimates: ## mean of the differences ## 894.3675 ``` </small> --- ## Replication: More on Balancing ```r plot(m.nn, type="jitter") ``` <!-- --> ``` ## [1] "To identify the units, use first mouse button; to stop, use second." ``` ``` ## integer(0) ``` --- ## What else can we do with propensity scores? Suppose you do not like the idea of throwing out data as we do with PSM An alternative is to use weighted least squares where the propensity scores are the weights. For treated individuals the weight is `$$\frac{1}{Pr(treat=1)}$$` For control individuals the weight is `$$\frac{1}{1-Pr(treat=1)}$$` --- ## Propensity score weights in R ```r # We will use our estimated pscores lalonde$psvaluea<-predict(glm1,type="response") lalonde$gweight<-ifelse(lalonde$treat==1,1/lalonde$psvaluea,1/(1-lalonde$psvaluea)) reg.4<-lm(re78~treat+age+educ+nodegree+re74+re75+married+black+hispan, data=lalonde, weights = gweight) ``` --- ## PSM weights <tiny> <table style="text-align:center"><tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td colspan="6"><em>Dependent variable:</em></td></tr> <tr><td></td><td colspan="6" style="border-bottom: 1px solid black"></td></tr> <tr><td style="text-align:left"></td><td colspan="6">OLS</td></tr> <tr><td style="text-align:left"></td><td>(1)</td><td>(2)</td><td>(3)</td><td>(4)</td><td>(5)</td><td>(6)</td></tr> <tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">treat</td><td>1,548.244<sup>**</sup></td><td>894.367</td><td>1,344.936<sup>*</sup></td><td>939.144</td><td>973.326</td><td>712.743</td></tr> <tr><td style="text-align:left"></td><td>(781.279)</td><td>(730.295)</td><td>(789.780)</td><td>(819.618)</td><td>(824.285)</td><td>(552.508)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">age</td><td>12.978</td><td></td><td>7.804</td><td></td><td>1.025</td><td>22.695</td></tr> <tr><td style="text-align:left"></td><td>(32.489)</td><td></td><td>(42.915)</td><td></td><td>(50.615)</td><td>(33.262)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">educ</td><td>403.941<sup>**</sup></td><td></td><td>602.203<sup>***</sup></td><td></td><td>499.794<sup>*</sup></td><td>440.717<sup>***</sup></td></tr> <tr><td style="text-align:left"></td><td>(158.906)</td><td></td><td>(224.070)</td><td></td><td>(260.168)</td><td>(167.840)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">nodegree</td><td>259.817</td><td></td><td>923.284</td><td></td><td>-117.358</td><td>750.598</td></tr> <tr><td style="text-align:left"></td><td>(847.442)</td><td></td><td>(1,109.915)</td><td></td><td>(1,209.181)</td><td>(834.893)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">re74</td><td>0.296<sup>***</sup></td><td></td><td>0.026</td><td></td><td>0.124</td><td>0.197<sup>***</sup></td></tr> <tr><td style="text-align:left"></td><td>(0.058)</td><td></td><td>(0.103)</td><td></td><td>(0.105)</td><td>(0.059)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">re75</td><td>0.232<sup>**</sup></td><td></td><td>0.221</td><td></td><td>0.132</td><td>0.439<sup>***</sup></td></tr> <tr><td style="text-align:left"></td><td>(0.105)</td><td></td><td>(0.160)</td><td></td><td>(0.164)</td><td>(0.108)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">married</td><td>406.621</td><td></td><td>-158.255</td><td></td><td>49.151</td><td>-433.395</td></tr> <tr><td style="text-align:left"></td><td>(695.472)</td><td></td><td>(986.307)</td><td></td><td>(1,087.943)</td><td>(654.412)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">black</td><td>-1,240.644</td><td></td><td>-469.434</td><td></td><td>-1,433.906</td><td>-958.637</td></tr> <tr><td style="text-align:left"></td><td>(768.764)</td><td></td><td>(1,009.928)</td><td></td><td>(1,004.361)</td><td>(610.182)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">hispan</td><td>498.897</td><td></td><td>1,064.045</td><td></td><td>-309.927</td><td>-351.844</td></tr> <tr><td style="text-align:left"></td><td>(941.943)</td><td></td><td>(1,300.198)</td><td></td><td>(1,426.997)</td><td>(910.924)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td style="text-align:left">Constant</td><td>66.515</td><td>5,454.776<sup>***</sup></td><td>-2,112.211</td><td>5,311.901<sup>***</sup></td><td>565.576</td><td>-444.515</td></tr> <tr><td style="text-align:left"></td><td>(2,436.746)</td><td>(516.396)</td><td>(3,511.770)</td><td>(538.650)</td><td>(3,864.384)</td><td>(2,529.555)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">Observations</td><td>614</td><td>370</td><td>370</td><td>257</td><td>257</td><td>614</td></tr> <tr><td style="text-align:left">R<sup>2</sup></td><td>0.148</td><td>0.004</td><td>0.049</td><td>0.005</td><td>0.075</td><td>0.127</td></tr> <tr><td style="text-align:left">Adjusted R<sup>2</sup></td><td>0.135</td><td>0.001</td><td>0.025</td><td>0.001</td><td>0.042</td><td>0.114</td></tr> <tr><td style="text-align:left">Residual Std. Error</td><td>6,947.917 (df = 604)</td><td>7,023.750 (df = 368)</td><td>6,939.857 (df = 360)</td><td>6,508.533 (df = 255)</td><td>6,375.292 (df = 247)</td><td>9,276.738 (df = 604)</td></tr> <tr><td style="text-align:left">F Statistic</td><td>11.636<sup>***</sup> (df = 9; 604)</td><td>1.500 (df = 1; 368)</td><td>2.054<sup>**</sup> (df = 9; 360)</td><td>1.313 (df = 1; 255)</td><td>2.238<sup>**</sup> (df = 9; 247)</td><td>9.788<sup>***</sup> (df = 9; 604)</td></tr> <tr><td colspan="7" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"><em>Note:</em></td><td colspan="6" style="text-align:right"><sup>*</sup>p<0.1; <sup>**</sup>p<0.05; <sup>***</sup>p<0.01</td></tr> </table> </tiny> --- ## Why are our results so off? Poor Balance <small> ```r summary(lm(re74~treat, data=lalonde, weights = gweight)) ``` ``` ## ## Call: ## lm(formula = re74 ~ treat, data = lalonde, weights = gweight) ## ## Weighted Residuals: ## Min 1Q Median 3Q Max ## -14181 -4678 -3338 3816 83133 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 4552.7 336.3 13.539 < 2e-16 *** ## treat -1620.6 488.8 -3.316 0.000969 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 8346 on 612 degrees of freedom ## Multiple R-squared: 0.01765, Adjusted R-squared: 0.01604 ## F-statistic: 10.99 on 1 and 612 DF, p-value: 0.0009686 ``` </small> --- ### Love Plot ```r library(cobalt) love.plot(m.nn, binary = "std") ``` <!-- --> --- ## Summary * PSM is useful when your binary treatment variable is endogenous, your explanatory variables are exogenous, and there a no available instruments. * It is a solution to the _"curse of dimensionality"_ * It can be used to construct a better control group when running regressions * Or on its own non-parametrically * There is a trade off between balance and sample size Extensions * PSM can also be used to control for sample selection bias by using inverse propensity score matching weights in your regressions. --- ### Example: Using Fake Data ```r X <- rnorm(1000)*5 + 1 er <- rnorm(1000)*4 treat <- ifelse(.7*X - .2*er+rnorm(1000)>0,1,0) mean(treat) y <- 10-3*X+2*treat+er mydata<-data.frame(y,X,treat) aggregate(mydata[,1:2],list(mydata$treat),mean) summary(lm(y~X+treat, data = mydata)) m.out1 <- matchit(treat ~ X, data = mydata, method = "nearest", distance = "logit") mydata2 <- match.data(m.out1) summary(lm(y~X+treat, data = mydata2)) ``` --- ### Example: Using Fake Data <table style="text-align:center"><tr><td colspan="3" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"></td><td colspan="2"><em>Dependent variable:</em></td></tr> <tr><td></td><td colspan="2" style="border-bottom: 1px solid black"></td></tr> <tr><td style="text-align:left"></td><td colspan="2">y</td></tr> <tr><td style="text-align:left"></td><td>(1)</td><td>(2)</td></tr> <tr><td colspan="3" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">X</td><td>-2.771<sup>***</sup></td><td>-2.807<sup>***</sup></td></tr> <tr><td style="text-align:left"></td><td>(0.036)</td><td>(0.042)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td></tr> <tr><td style="text-align:left">treat</td><td>-1.626<sup>***</sup></td><td>-1.223<sup>***</sup></td></tr> <tr><td style="text-align:left"></td><td>(0.380)</td><td>(0.474)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td></tr> <tr><td style="text-align:left">Constant</td><td>11.824<sup>***</sup></td><td>11.700<sup>***</sup></td></tr> <tr><td style="text-align:left"></td><td>(0.227)</td><td>(0.242)</td></tr> <tr><td style="text-align:left"></td><td></td><td></td></tr> <tr><td colspan="3" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left">Observations</td><td>1,000</td><td>872</td></tr> <tr><td style="text-align:left">R<sup>2</sup></td><td>0.937</td><td>0.943</td></tr> <tr><td style="text-align:left">Adjusted R<sup>2</sup></td><td>0.937</td><td>0.943</td></tr> <tr><td style="text-align:left">Residual Std. Error</td><td>3.947 (df = 997)</td><td>3.999 (df = 869)</td></tr> <tr><td style="text-align:left">F Statistic</td><td>7,407.025<sup>***</sup> (df = 2; 997)</td><td>7,185.331<sup>***</sup> (df = 2; 869)</td></tr> <tr><td colspan="3" style="border-bottom: 1px solid black"></td></tr><tr><td style="text-align:left"><em>Note:</em></td><td colspan="2" style="text-align:right"><sup>*</sup>p<0.1; <sup>**</sup>p<0.05; <sup>***</sup>p<0.01</td></tr> </table>