SlideShare a Scribd company logo
1 of 20
Download to read offline
Motivation Estimator CBPS Function Do-It-Yourself References
Covariate Balancing Propensity Score
Stata User-Written Function
Filip Premik
University of Minnesota, FAME|GRAPE
April 4, 2018
F. Premik 1/20
Motivation Estimator CBPS Function Do-It-Yourself References
Contents:
1 Motivation
2 Estimator
3 CBPS Function
4 Do-It-Yourself
Author gratefully acknowledges the support of the National Science Centr.e
(grant #2016/23/N/HS4/03637)
F. Premik 2/20
Motivation Estimator CBPS Function Do-It-Yourself References
Motivation
F. Premik 3/20
Motivation Estimator CBPS Function Do-It-Yourself References
Motivation
The task is to estimate propensity score — the conditional probability of treatment
assignment for further use in causal analysis (matching, weighting, etc.).
Usually the propensity score model is misspecified — it might lead to severely biased
estimates of treatment effects.
Given the successful estimation distributions of covariates in the treated and non-treated
cells should be statistically equal. Any significant discrepancy might indicate either the mis-
specification of probability model or a failure of CIA assumption (Caliendo and Kopeinig,
2008).
Therefore one of the most frequently done checks of the quality of propensity score
estimates is a covariate balance check (Dehejia and Wahba, 2002).
F. Premik 4/20
Motivation Estimator CBPS Function Do-It-Yourself References
Motivation
The dual nature of propensity score:
covariate balancing score,
conditional probability of treatment assignment.
Imai and Ratkovic (2014) exploit the dual nature of propensity score and propose an estimator
that automatically produces covariate balancing — Covariate Balancing Propensity Score
(CBPS) estimator.
Here: Stata implementation.
F. Premik 5/20
Motivation Estimator CBPS Function Do-It-Yourself References
Estimator
F. Premik 6/20
Motivation Estimator CBPS Function Do-It-Yourself References
Framework
Standard causal analysis framework. Let:
Ti be a binary treatment indicator for a unit i,
πβ(xi ) = P[Ti = 1|xi ; β] be a conditional probability of treatment assignement,
xi is a vector of covariates,
yi ≡ Ti y1i + (1 − Ti )y0i is the outcome of interest,
CIA in the spirit of Rosenbaum and Rubin (1983) holds, i.e.:
(y0i , y1i ) ⊥⊥ Ti |πβ(xi )
.
F. Premik 7/20
Motivation Estimator CBPS Function Do-It-Yourself References
ML score conditions...
Let start with classical ML estimation of propensity score. One might write the log-likelihood
function as:
ˆβMLE
= arg max
β
N
i=1
Ti log{πβ(xi )} + (1 − Ti ) log{1 − πβ(xi )} (1)
The first order conditions (so called score conditions) are as follows:
1
N
N
i=1
Ti πβ(xi )
πβ(xi )
−
(1 − Ti )πβ(xi )
1 − πβ(xi )
= 0 (2)
Rewrite it a little bit...
1
N
N
i=1
Ti πβ(xi )
πβ(xi )
=
1
N
N
i=1
(1 − Ti )πβ(xi )
1 − πβ(xi )
(3)
F. Premik 8/20
Motivation Estimator CBPS Function Do-It-Yourself References
...are balancing conditions...
... and switch the focus for population values which are estimated by sample means:
1
N
N
i=1
Ti πβ(xi )
πβ(xi )
=
1
N
N
i=1
(1 − Ti )πβ(xi )
1 − πβ(xi )
E
Ti πβ(xi )
πβ(xi )
= E
(1 − Ti )πβ(xi )
1 − πβ(xi )
The equation above tells us nothing more but the fact that likelihood methods balance the
distribution of derivative of assumed probability function. The more weight in PS is given to
covariates that are predictive of treatent assignment.
F. Premik 9/20
Motivation Estimator CBPS Function Do-It-Yourself References
... which may be used to impose CIA
Observe that the last equation should be satisfied not only for the score vector but for all
measurable functions f (·) (provided expectations exist).
E
Ti f (xi )
πβ(xi )
= E
(1 − Ti )f (xi )
1 − πβ(xi )
In particular, we might consider f (xi ) = xi and obtain:
E
Ti xi
πβ(xi )
= E
(1 − Ti )xi
1 − πβ(xi )
Which says that (weighted) means across covariates given the PS are equal. This is nothing
else but the balancing property we wanted to obtain!
F. Premik 10/20
Motivation Estimator CBPS Function Do-It-Yourself References
GMM Estimation
Rewrite the problem in GMM context. Define:
Sample analog of ML score conditions:
sβ(Ti , xi ) ≡
Ti πβ(xi )
πβ(xi )
−
(1 − Ti )πβ(xi )
1 − πβ(xi )
=
Ti − πβ(xi )
πβ(xi )(1 − πβ(xi ))
· πβ(xi ) = 0 (4)
Sample analog for covariate balancing conditions (first moments):
wβ(Ti , Xi ) ≡
Ti − πβ(Xi )
πβ(Xi )(1 − πβ(Xi ))
· xi = 0 (5)
F. Premik 11/20
Motivation Estimator CBPS Function Do-It-Yourself References
GMM Estimation
Imai and Ratkovic (2014) propose the following GMM estimator:
ˆβGMM
= arg min
β∈Θ
gβ(T, X) Σβ(T, X)−1
g(T, X) (6)
where g(T, X) = N
i=1 gβ(Ti , Xi ) is the sample mean of moment conditions. Depending on
what we want to achieve we might use:
gβ(Ti , Xi ) Balances Estimator Specification test
1) sβ(Ti , Xi ) ML score — more weight on
variables with predictive power
binomial MLE –
2) wβ(Ti , Xi ) first moments of covariates just-identified GMM –
3)
sβ(Ti , Xi )
wβ(Ti , Xi )
both over-identified GMM
F. Premik 12/20
Motivation Estimator CBPS Function Do-It-Yourself References
Comments
Misspecification of MLE leads to inconsistent estimates. CBPS is robust by exploiting the
dual nature of propensity score (Imai and Ratkovic, 2014).
All formulas up to now were presented for ATE estimation. For the effect on the treated
substitute:
wβ(Ti , Xi ) =
N
N1
Ti − πβ(Xi )
1 − πβ(Xi )
(7)
Two-step efficient GMM with analytically derived Σβ(T, X) ≡ E[gβ(Ti , Xi )gβ(Ti , Xi ) ].
The probability model is logistic, however no obstacle appears if one wants to replace it
with probit or others.
Starting values comes from the first step logit estimation.
Gradient methods usually work well (BFGS algorithm, Imai and Ratkovic (2014)).
F. Premik 13/20
Motivation Estimator CBPS Function Do-It-Yourself References
CBPS Function
F. Premik 14/20
Motivation Estimator CBPS Function Do-It-Yourself References
Stata Implementation
Syntax
CBPS depvar indepvars [if exp] [in range] [, over ate att logit probit evaluator_type(string)
optimization_technique(string) ]
Options
ate calculates the propensity score using ATE formulas.
att calculates the propensity score using ATT formulas, this is the default option.
over imposes overidentifying restrictions coming from the ML first order conditions.
logit uses logistic probability distribution as a functional form for πβ(·), this is the default
option.
probit uses normal probability distribution as a functional form for πβ(·).
optimization_technique(string) sets the optimization technique. See optimize() for
more details. The default value is bfgs.
evaluator_type(string) sets the evaluator type for optimization process. See opti-
mize() for more details. The default value is gf1.
F. Premik 15/20
Motivation Estimator CBPS Function Do-It-Yourself References
Stata Implementation
Saved results
Scalars
e(N) e(N1) e(N0)
e(J) J-Stat in χ2
overidentification test
e(Jdf) number of degrees of freedom in χ2
overidentification test
e(Jpval) p-value in χ2
overidentification test
Macros
e(predict)
e(cmdline)
e(cmd) e(type)
e(properties)
e(depvar)
Matrices
e(b)
e(V)
F. Premik 16/20
Motivation Estimator CBPS Function Do-It-Yourself References
Stata Implementation
Postestimation
predict newvar [, replace bscore pscore] — saves the predicted propensity scores
or balancing weights
CBPS_imbalance — calculates the overall and treated-specific covariate imbalance (Rosen-
baum and Rubin, 1985). They should equal zero for ATE and ATT just-identified esti-
mation respectively – a simple check if the optimization algorithm has found the proper
minimum.
F. Premik 17/20
Motivation Estimator CBPS Function Do-It-Yourself References
Do-It-Yourself
F. Premik 18/20
Motivation Estimator CBPS Function Do-It-Yourself References
Do-It-Yourself
set more off
use http://www.ats.ucla.edu/stat/stata/dae/binary.dta,
clear
logit admit gre gpa ib4.rank
CBPS_imbalance
estimates store mle
CBPS admit gre gpa ib4.rank, ate
CBPS_imbalance
estimates store jate
CBPS admit gre gpa ib4.rank, over ate
CBPS_imbalance
estimates store oate
CBPS admit gre gpa ib4.rank
CBPS_imbalance
estimates store jatt
CBPS admit gre gpa ib4.rank, over
CBPS_imbalance
estimates store oatt
esttab mle jate oate jatt oatt , mti-
tles("logit" "exact ate" "over ate"
"exact att" "over att") /// sfmt(3)
scalars(imbalance_ate imbalance_att J
Jpval)
F. Premik 19/20
Motivation Estimator CBPS Function Do-It-Yourself References
References
Caliendo, M., and S. Kopeinig (2008): “Some practical guidance for the implementation of propensity score
matching,” Journal of economic surveys, 22(1), 31–72.
Dehejia, R. H., and S. Wahba (2002): “Propensity score-matching methods for nonexperimental causal studies,”
Review of Economics and statistics, 84(1), 151–161.
Imai, K., and M. Ratkovic (2014): “Covariate balancing propensity score,” Journal of the Royal Statistical Society:
Series B (Statistical Methodology), 76(1), 243–263.
Rosenbaum, P. R., and D. B. Rubin (1983): “The central role of the propensity score in observational studies for
causal effects,” Biometrika, 70(1), 41–55.
(1985): “Constructing a control group using multivariate matched sampling methods that incorporate the
propensity score,” The American Statistician, 39(1), 33–38.
F. Premik 20/20

More Related Content

What's hot

Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011
Moses sichei
 
Chapter 1 - the role of financial management
Chapter 1  - the role of financial managementChapter 1  - the role of financial management
Chapter 1 - the role of financial management
Prafulla Tekriwal
 

What's hot (20)

Gregory mankiw macroeconomic 7th edition chapter (4)
Gregory mankiw macroeconomic 7th edition chapter  (4)Gregory mankiw macroeconomic 7th edition chapter  (4)
Gregory mankiw macroeconomic 7th edition chapter (4)
 
Chapter 08 Risk & Return
Chapter 08 Risk & ReturnChapter 08 Risk & Return
Chapter 08 Risk & Return
 
Bayesian Structural Equations Modeling (SEM)
Bayesian Structural Equations Modeling (SEM)Bayesian Structural Equations Modeling (SEM)
Bayesian Structural Equations Modeling (SEM)
 
MACROECONOMICS-CH4
MACROECONOMICS-CH4MACROECONOMICS-CH4
MACROECONOMICS-CH4
 
9780273713654 pp02
9780273713654 pp029780273713654 pp02
9780273713654 pp02
 
Gregory mankiw macroeconomic 7th edition chapter (12)
Gregory mankiw macroeconomic 7th edition chapter  (12)Gregory mankiw macroeconomic 7th edition chapter  (12)
Gregory mankiw macroeconomic 7th edition chapter (12)
 
Gregory mankiw macroeconomic 7th edition chapter (5)
Gregory mankiw macroeconomic 7th edition chapter  (5)Gregory mankiw macroeconomic 7th edition chapter  (5)
Gregory mankiw macroeconomic 7th edition chapter (5)
 
Advanced Microeconomics - Lecture Slides
Advanced Microeconomics - Lecture SlidesAdvanced Microeconomics - Lecture Slides
Advanced Microeconomics - Lecture Slides
 
Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011Lecture 7B Panel Econometrics I 2011
Lecture 7B Panel Econometrics I 2011
 
Chapter 1 - the role of financial management
Chapter 1  - the role of financial managementChapter 1  - the role of financial management
Chapter 1 - the role of financial management
 
Gregory mankiw macroeconomic 7th edition chapter (15)
Gregory mankiw macroeconomic 7th edition chapter  (15)Gregory mankiw macroeconomic 7th edition chapter  (15)
Gregory mankiw macroeconomic 7th edition chapter (15)
 
Model Risk Management : Best Practices
Model Risk Management : Best PracticesModel Risk Management : Best Practices
Model Risk Management : Best Practices
 
Chapter 2 - The Business, Tax, and Financial Environments
Chapter 2 - The Business, Tax, and Financial EnvironmentsChapter 2 - The Business, Tax, and Financial Environments
Chapter 2 - The Business, Tax, and Financial Environments
 
Gregory mankiw macroeconomic 7th edition chapter (6)
Gregory mankiw macroeconomic 7th edition chapter  (6)Gregory mankiw macroeconomic 7th edition chapter  (6)
Gregory mankiw macroeconomic 7th edition chapter (6)
 
YamadaiR(Categorical Factor Analysis)
YamadaiR(Categorical Factor Analysis)YamadaiR(Categorical Factor Analysis)
YamadaiR(Categorical Factor Analysis)
 
Financial Management Slides Ch 03
Financial Management Slides Ch 03Financial Management Slides Ch 03
Financial Management Slides Ch 03
 
9780273713654 pp11
9780273713654 pp119780273713654 pp11
9780273713654 pp11
 
Financial Management Slides Ch 14
Financial Management Slides Ch 14Financial Management Slides Ch 14
Financial Management Slides Ch 14
 
Financial Management Slides Ch 16
Financial Management Slides Ch 16Financial Management Slides Ch 16
Financial Management Slides Ch 16
 
Cramer row inequality
Cramer row inequality Cramer row inequality
Cramer row inequality
 

Similar to Covariate balancing propensity score STATA user written code by Filip Premik

Similar to Covariate balancing propensity score STATA user written code by Filip Premik (20)

Statistical Decision Theory
Statistical Decision TheoryStatistical Decision Theory
Statistical Decision Theory
 
Slides econometrics-2017-graduate-2
Slides econometrics-2017-graduate-2Slides econometrics-2017-graduate-2
Slides econometrics-2017-graduate-2
 
Side Notes on Practical Natural Language Processing: Bootstrap Test
Side Notes on Practical Natural Language Processing: Bootstrap TestSide Notes on Practical Natural Language Processing: Bootstrap Test
Side Notes on Practical Natural Language Processing: Bootstrap Test
 
CS229 Machine Learning Lecture Notes
CS229 Machine Learning Lecture NotesCS229 Machine Learning Lecture Notes
CS229 Machine Learning Lecture Notes
 
Hessian Matrices in Statistics
Hessian Matrices in StatisticsHessian Matrices in Statistics
Hessian Matrices in Statistics
 
Litvinenko nlbu2016
Litvinenko nlbu2016Litvinenko nlbu2016
Litvinenko nlbu2016
 
Solving inverse problems via non-linear Bayesian Update of PCE coefficients
Solving inverse problems via non-linear Bayesian Update of PCE coefficientsSolving inverse problems via non-linear Bayesian Update of PCE coefficients
Solving inverse problems via non-linear Bayesian Update of PCE coefficients
 
Statistics Assignment Help
Statistics Assignment HelpStatistics Assignment Help
Statistics Assignment Help
 
Counterfactual Learning for Recommendation
Counterfactual Learning for RecommendationCounterfactual Learning for Recommendation
Counterfactual Learning for Recommendation
 
Deep Reinforcement Learning Through Policy Optimization, John Schulman, OpenAI
Deep Reinforcement Learning Through Policy Optimization, John Schulman, OpenAIDeep Reinforcement Learning Through Policy Optimization, John Schulman, OpenAI
Deep Reinforcement Learning Through Policy Optimization, John Schulman, OpenAI
 
効率的反実仮想学習
効率的反実仮想学習効率的反実仮想学習
効率的反実仮想学習
 
An Empirical Investigation Of The Arbitrage Pricing Theory
An Empirical Investigation Of The Arbitrage Pricing TheoryAn Empirical Investigation Of The Arbitrage Pricing Theory
An Empirical Investigation Of The Arbitrage Pricing Theory
 
20 bayes learning
20 bayes learning20 bayes learning
20 bayes learning
 
A Systematic Approach To Probabilistic Pointer Analysis
A Systematic Approach To Probabilistic Pointer AnalysisA Systematic Approach To Probabilistic Pointer Analysis
A Systematic Approach To Probabilistic Pointer Analysis
 
PCB_Lect02_Pairwise_allign (1).pdf
PCB_Lect02_Pairwise_allign (1).pdfPCB_Lect02_Pairwise_allign (1).pdf
PCB_Lect02_Pairwise_allign (1).pdf
 
Daa unit 5
Daa unit 5Daa unit 5
Daa unit 5
 
Machine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
Machine learning by Dr. Vivek Vijay and Dr. Sandeep YadavMachine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
Machine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
 
Probability cheatsheet
Probability cheatsheetProbability cheatsheet
Probability cheatsheet
 
3_MLE_printable.pdf
3_MLE_printable.pdf3_MLE_printable.pdf
3_MLE_printable.pdf
 
working with python
working with pythonworking with python
working with python
 

More from GRAPE

Presentation_Yale.pdf
Presentation_Yale.pdfPresentation_Yale.pdf
Presentation_Yale.pdf
GRAPE
 
Presentation_Columbia.pdf
Presentation_Columbia.pdfPresentation_Columbia.pdf
Presentation_Columbia.pdf
GRAPE
 

More from GRAPE (20)

Gender board diversity and firm performance
Gender board diversity and firm performanceGender board diversity and firm performance
Gender board diversity and firm performance
 
Gender board diversity and firm performance: evidence from European data
Gender board diversity and firm performance: evidence from European dataGender board diversity and firm performance: evidence from European data
Gender board diversity and firm performance: evidence from European data
 
Demographic transition and the rise of wealth inequality
Demographic transition and the rise of wealth inequalityDemographic transition and the rise of wealth inequality
Demographic transition and the rise of wealth inequality
 
(Gender) tone at the top: the effect of board diversity on gender inequality
(Gender) tone at the top: the effect of board diversity on gender inequality(Gender) tone at the top: the effect of board diversity on gender inequality
(Gender) tone at the top: the effect of board diversity on gender inequality
 
Gender board diversity spillovers and the public eye
Gender board diversity spillovers and the public eyeGender board diversity spillovers and the public eye
Gender board diversity spillovers and the public eye
 
Wage Inequality and women's self-employment
Wage Inequality and women's self-employmentWage Inequality and women's self-employment
Wage Inequality and women's self-employment
 
Contracts with Interdependent Preferences (2)
Contracts with Interdependent Preferences (2)Contracts with Interdependent Preferences (2)
Contracts with Interdependent Preferences (2)
 
Empathy in risky choices on behalf of others
Empathy in risky choices on behalf of othersEmpathy in risky choices on behalf of others
Empathy in risky choices on behalf of others
 
Contracts with Interdependent Preferences
Contracts with Interdependent PreferencesContracts with Interdependent Preferences
Contracts with Interdependent Preferences
 
Tone at the top: the effects of gender board diversity on gender wage inequal...
Tone at the top: the effects of gender board diversity on gender wage inequal...Tone at the top: the effects of gender board diversity on gender wage inequal...
Tone at the top: the effects of gender board diversity on gender wage inequal...
 
Gender board diversity spillovers and the public eye
Gender board diversity spillovers and the public eyeGender board diversity spillovers and the public eye
Gender board diversity spillovers and the public eye
 
The European Unemployment Puzzle: implications from population aging
The European Unemployment Puzzle: implications from population agingThe European Unemployment Puzzle: implications from population aging
The European Unemployment Puzzle: implications from population aging
 
ENTIME_GEM___GAP.pdf
ENTIME_GEM___GAP.pdfENTIME_GEM___GAP.pdf
ENTIME_GEM___GAP.pdf
 
POSTER_EARHART.pdf
POSTER_EARHART.pdfPOSTER_EARHART.pdf
POSTER_EARHART.pdf
 
Boston_College Slides.pdf
Boston_College Slides.pdfBoston_College Slides.pdf
Boston_College Slides.pdf
 
Presentation_Yale.pdf
Presentation_Yale.pdfPresentation_Yale.pdf
Presentation_Yale.pdf
 
Presentation_Columbia.pdf
Presentation_Columbia.pdfPresentation_Columbia.pdf
Presentation_Columbia.pdf
 
Presentation.pdf
Presentation.pdfPresentation.pdf
Presentation.pdf
 
Presentation.pdf
Presentation.pdfPresentation.pdf
Presentation.pdf
 
Presentation.pdf
Presentation.pdfPresentation.pdf
Presentation.pdf
 

Recently uploaded

VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
dipikadinghjn ( Why You Choose Us? ) Escorts
 

Recently uploaded (20)

Webinar on E-Invoicing for Fintech Belgium
Webinar on E-Invoicing for Fintech BelgiumWebinar on E-Invoicing for Fintech Belgium
Webinar on E-Invoicing for Fintech Belgium
 
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbaiVasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
 
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
 
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
(INDIRA) Call Girl Mumbai Call Now 8250077686 Mumbai Escorts 24x7
 
call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Sant Nagar (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
 
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
 
Navi Mumbai Cooperetive Housewife Call Girls-9833754194-Natural Panvel Enjoye...
Navi Mumbai Cooperetive Housewife Call Girls-9833754194-Natural Panvel Enjoye...Navi Mumbai Cooperetive Housewife Call Girls-9833754194-Natural Panvel Enjoye...
Navi Mumbai Cooperetive Housewife Call Girls-9833754194-Natural Panvel Enjoye...
 
Indore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdfIndore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdf
 
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure serviceWhatsApp 📞 Call : 9892124323  ✅Call Girls In Chembur ( Mumbai ) secure service
WhatsApp 📞 Call : 9892124323 ✅Call Girls In Chembur ( Mumbai ) secure service
 
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Banaswadi Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Shivane  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Shivane 6297143586 Call Hot Indian Gi...
 
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
VIP Independent Call Girls in Andheri 🌹 9920725232 ( Call Me ) Mumbai Escorts...
 
VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Taloja 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
 
VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
VIP Independent Call Girls in Mumbai 🌹 9920725232 ( Call Me ) Mumbai Escorts ...
 
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
 
Mira Road Awesome 100% Independent Call Girls NUmber-9833754194-Dahisar Inter...
Mira Road Awesome 100% Independent Call Girls NUmber-9833754194-Dahisar Inter...Mira Road Awesome 100% Independent Call Girls NUmber-9833754194-Dahisar Inter...
Mira Road Awesome 100% Independent Call Girls NUmber-9833754194-Dahisar Inter...
 
Top Rated Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated  Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...Top Rated  Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
 
Top Rated Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 

Covariate balancing propensity score STATA user written code by Filip Premik

  • 1. Motivation Estimator CBPS Function Do-It-Yourself References Covariate Balancing Propensity Score Stata User-Written Function Filip Premik University of Minnesota, FAME|GRAPE April 4, 2018 F. Premik 1/20
  • 2. Motivation Estimator CBPS Function Do-It-Yourself References Contents: 1 Motivation 2 Estimator 3 CBPS Function 4 Do-It-Yourself Author gratefully acknowledges the support of the National Science Centr.e (grant #2016/23/N/HS4/03637) F. Premik 2/20
  • 3. Motivation Estimator CBPS Function Do-It-Yourself References Motivation F. Premik 3/20
  • 4. Motivation Estimator CBPS Function Do-It-Yourself References Motivation The task is to estimate propensity score — the conditional probability of treatment assignment for further use in causal analysis (matching, weighting, etc.). Usually the propensity score model is misspecified — it might lead to severely biased estimates of treatment effects. Given the successful estimation distributions of covariates in the treated and non-treated cells should be statistically equal. Any significant discrepancy might indicate either the mis- specification of probability model or a failure of CIA assumption (Caliendo and Kopeinig, 2008). Therefore one of the most frequently done checks of the quality of propensity score estimates is a covariate balance check (Dehejia and Wahba, 2002). F. Premik 4/20
  • 5. Motivation Estimator CBPS Function Do-It-Yourself References Motivation The dual nature of propensity score: covariate balancing score, conditional probability of treatment assignment. Imai and Ratkovic (2014) exploit the dual nature of propensity score and propose an estimator that automatically produces covariate balancing — Covariate Balancing Propensity Score (CBPS) estimator. Here: Stata implementation. F. Premik 5/20
  • 6. Motivation Estimator CBPS Function Do-It-Yourself References Estimator F. Premik 6/20
  • 7. Motivation Estimator CBPS Function Do-It-Yourself References Framework Standard causal analysis framework. Let: Ti be a binary treatment indicator for a unit i, πβ(xi ) = P[Ti = 1|xi ; β] be a conditional probability of treatment assignement, xi is a vector of covariates, yi ≡ Ti y1i + (1 − Ti )y0i is the outcome of interest, CIA in the spirit of Rosenbaum and Rubin (1983) holds, i.e.: (y0i , y1i ) ⊥⊥ Ti |πβ(xi ) . F. Premik 7/20
  • 8. Motivation Estimator CBPS Function Do-It-Yourself References ML score conditions... Let start with classical ML estimation of propensity score. One might write the log-likelihood function as: ˆβMLE = arg max β N i=1 Ti log{πβ(xi )} + (1 − Ti ) log{1 − πβ(xi )} (1) The first order conditions (so called score conditions) are as follows: 1 N N i=1 Ti πβ(xi ) πβ(xi ) − (1 − Ti )πβ(xi ) 1 − πβ(xi ) = 0 (2) Rewrite it a little bit... 1 N N i=1 Ti πβ(xi ) πβ(xi ) = 1 N N i=1 (1 − Ti )πβ(xi ) 1 − πβ(xi ) (3) F. Premik 8/20
  • 9. Motivation Estimator CBPS Function Do-It-Yourself References ...are balancing conditions... ... and switch the focus for population values which are estimated by sample means: 1 N N i=1 Ti πβ(xi ) πβ(xi ) = 1 N N i=1 (1 − Ti )πβ(xi ) 1 − πβ(xi ) E Ti πβ(xi ) πβ(xi ) = E (1 − Ti )πβ(xi ) 1 − πβ(xi ) The equation above tells us nothing more but the fact that likelihood methods balance the distribution of derivative of assumed probability function. The more weight in PS is given to covariates that are predictive of treatent assignment. F. Premik 9/20
  • 10. Motivation Estimator CBPS Function Do-It-Yourself References ... which may be used to impose CIA Observe that the last equation should be satisfied not only for the score vector but for all measurable functions f (·) (provided expectations exist). E Ti f (xi ) πβ(xi ) = E (1 − Ti )f (xi ) 1 − πβ(xi ) In particular, we might consider f (xi ) = xi and obtain: E Ti xi πβ(xi ) = E (1 − Ti )xi 1 − πβ(xi ) Which says that (weighted) means across covariates given the PS are equal. This is nothing else but the balancing property we wanted to obtain! F. Premik 10/20
  • 11. Motivation Estimator CBPS Function Do-It-Yourself References GMM Estimation Rewrite the problem in GMM context. Define: Sample analog of ML score conditions: sβ(Ti , xi ) ≡ Ti πβ(xi ) πβ(xi ) − (1 − Ti )πβ(xi ) 1 − πβ(xi ) = Ti − πβ(xi ) πβ(xi )(1 − πβ(xi )) · πβ(xi ) = 0 (4) Sample analog for covariate balancing conditions (first moments): wβ(Ti , Xi ) ≡ Ti − πβ(Xi ) πβ(Xi )(1 − πβ(Xi )) · xi = 0 (5) F. Premik 11/20
  • 12. Motivation Estimator CBPS Function Do-It-Yourself References GMM Estimation Imai and Ratkovic (2014) propose the following GMM estimator: ˆβGMM = arg min β∈Θ gβ(T, X) Σβ(T, X)−1 g(T, X) (6) where g(T, X) = N i=1 gβ(Ti , Xi ) is the sample mean of moment conditions. Depending on what we want to achieve we might use: gβ(Ti , Xi ) Balances Estimator Specification test 1) sβ(Ti , Xi ) ML score — more weight on variables with predictive power binomial MLE – 2) wβ(Ti , Xi ) first moments of covariates just-identified GMM – 3) sβ(Ti , Xi ) wβ(Ti , Xi ) both over-identified GMM F. Premik 12/20
  • 13. Motivation Estimator CBPS Function Do-It-Yourself References Comments Misspecification of MLE leads to inconsistent estimates. CBPS is robust by exploiting the dual nature of propensity score (Imai and Ratkovic, 2014). All formulas up to now were presented for ATE estimation. For the effect on the treated substitute: wβ(Ti , Xi ) = N N1 Ti − πβ(Xi ) 1 − πβ(Xi ) (7) Two-step efficient GMM with analytically derived Σβ(T, X) ≡ E[gβ(Ti , Xi )gβ(Ti , Xi ) ]. The probability model is logistic, however no obstacle appears if one wants to replace it with probit or others. Starting values comes from the first step logit estimation. Gradient methods usually work well (BFGS algorithm, Imai and Ratkovic (2014)). F. Premik 13/20
  • 14. Motivation Estimator CBPS Function Do-It-Yourself References CBPS Function F. Premik 14/20
  • 15. Motivation Estimator CBPS Function Do-It-Yourself References Stata Implementation Syntax CBPS depvar indepvars [if exp] [in range] [, over ate att logit probit evaluator_type(string) optimization_technique(string) ] Options ate calculates the propensity score using ATE formulas. att calculates the propensity score using ATT formulas, this is the default option. over imposes overidentifying restrictions coming from the ML first order conditions. logit uses logistic probability distribution as a functional form for πβ(·), this is the default option. probit uses normal probability distribution as a functional form for πβ(·). optimization_technique(string) sets the optimization technique. See optimize() for more details. The default value is bfgs. evaluator_type(string) sets the evaluator type for optimization process. See opti- mize() for more details. The default value is gf1. F. Premik 15/20
  • 16. Motivation Estimator CBPS Function Do-It-Yourself References Stata Implementation Saved results Scalars e(N) e(N1) e(N0) e(J) J-Stat in χ2 overidentification test e(Jdf) number of degrees of freedom in χ2 overidentification test e(Jpval) p-value in χ2 overidentification test Macros e(predict) e(cmdline) e(cmd) e(type) e(properties) e(depvar) Matrices e(b) e(V) F. Premik 16/20
  • 17. Motivation Estimator CBPS Function Do-It-Yourself References Stata Implementation Postestimation predict newvar [, replace bscore pscore] — saves the predicted propensity scores or balancing weights CBPS_imbalance — calculates the overall and treated-specific covariate imbalance (Rosen- baum and Rubin, 1985). They should equal zero for ATE and ATT just-identified esti- mation respectively – a simple check if the optimization algorithm has found the proper minimum. F. Premik 17/20
  • 18. Motivation Estimator CBPS Function Do-It-Yourself References Do-It-Yourself F. Premik 18/20
  • 19. Motivation Estimator CBPS Function Do-It-Yourself References Do-It-Yourself set more off use http://www.ats.ucla.edu/stat/stata/dae/binary.dta, clear logit admit gre gpa ib4.rank CBPS_imbalance estimates store mle CBPS admit gre gpa ib4.rank, ate CBPS_imbalance estimates store jate CBPS admit gre gpa ib4.rank, over ate CBPS_imbalance estimates store oate CBPS admit gre gpa ib4.rank CBPS_imbalance estimates store jatt CBPS admit gre gpa ib4.rank, over CBPS_imbalance estimates store oatt esttab mle jate oate jatt oatt , mti- tles("logit" "exact ate" "over ate" "exact att" "over att") /// sfmt(3) scalars(imbalance_ate imbalance_att J Jpval) F. Premik 19/20
  • 20. Motivation Estimator CBPS Function Do-It-Yourself References References Caliendo, M., and S. Kopeinig (2008): “Some practical guidance for the implementation of propensity score matching,” Journal of economic surveys, 22(1), 31–72. Dehejia, R. H., and S. Wahba (2002): “Propensity score-matching methods for nonexperimental causal studies,” Review of Economics and statistics, 84(1), 151–161. Imai, K., and M. Ratkovic (2014): “Covariate balancing propensity score,” Journal of the Royal Statistical Society: Series B (Statistical Methodology), 76(1), 243–263. Rosenbaum, P. R., and D. B. Rubin (1983): “The central role of the propensity score in observational studies for causal effects,” Biometrika, 70(1), 41–55. (1985): “Constructing a control group using multivariate matched sampling methods that incorporate the propensity score,” The American Statistician, 39(1), 33–38. F. Premik 20/20