This book provides an introduction to the field of microeconometrics through the use of R. The focus is on applying current learning from the field to real world problems. It uses R to both teach the concepts of the field and show the reader how the techniques can be used. It is aimed at the general reader with the equivalent of a bachelor’s degree in economics, statistics or some more technical field. It covers the standard tools of microeconometrics, OLS, instrumental variables, Heckman selection and difference in difference. In addition, it introduces bounds, factor models, mixture models and empirical Bayesian analysis.
Author(s): Christopher P. Adams
Series: The R Series
Publisher: CRC Press
Year: 2020
Language: English
Pages: 398
City: Boca Raton
Cover
Half Title
Series Page
Title Page
Copyright Page
Dedication
Contents
Introduction
I:
Experiments
1. Ordinary Least Squares
1.1 Introduction
1.2. Estimating the Causal Effect
1.2.1. Graphing the Causal Effect
1.2.2. A Linear Causal Model
1.2.3. Simulation of the Causal Effect
1.2.4. Averaging to Estimate the Causal Effect
1.2.5. Assumptions of the OLS Model
1.3. Matrix Algebra of the OLS Model
1.3.1. Standard Algebra of the OLS Model
1.3.2. Algebraic OLS Estimator in R
1.3.3. Using Matrices
1.3.4. Multiplying Matrices in R
1.3.5. Matrix Estimator of OLS
1.3.6. Matrix Estimator of OLS in R
1.4. Least Squares Method for OLS
1.4.1. Moment Estimation
1.4.2. Algebra of Least Squares
1.4.3. Estimating Least Squares in R
1.4.4. The lm() Function
1.5. Measuring Uncertainty
1.5.1. Data Simulations
1.5.2. Introduction to the Bootstrap
1.5.3. Bootstrap in R
1.5.4. Standard Errors
1.6. Returns to Schooling
1.6.1. A Linear Model of Returns to Schooling
1.6.2. NLSM Data
1.6.3. Plotting Returns to Schooling
1.6.4. Estimating Returns to Schooling
1.7. Discussion and Further Reading
2. Multiple Regression
2.1. Introduction
2.2. Long and Short Regression
2.2.1. Using Short Regression
2.2.2. Independent Explanatory Variables
2.2.3. Dependent Explanatory Variables
2.2.4. Simulation with Multiple Explanatory Variables
2.2.5. Matrix Algebra of Short Regression
2.3. Collinearity and Multicollinearity
2.3.1. Matrix Algebra of Multicollinearity
2.3.2. Understanding Multicollinearity with R
2.4. Returns to Schooling
2.4.1. Multiple Regression of Returns to Schooling
2.4.2. NLSM Data
2.4.3. OLS Estimates of Returns to Schooling
2.5. Causal Pathways
2.5.1. Dual Path Model
2.5.2. Simulation of Dual Path Model
2.5.3. Dual Path Estimator Versus Long Regression
2.5.4. Matrix Algebra of the Dual Path Estimator
2.5.5. Dual Path Estimator in R
2.6. Are Bankers Racist or Greedy?
2.6.1. Boston HMDA Data
2.6.2. Causal Pathways of Discrimination
2.6.3. Estimating the Direct Effect
2.6.4. Adding in More Variables
2.6.5. Bootstrap Dual Path Estimator in R
2.6.6. Policy Implications of Dual Path Estimates
2.7. Discussion and Further Reading
3. Instrumental Variables
3.1. Introduction
3.2. A Confounded Model
3.2.1. Confounded Model DAG
3.2.2. Confounded Linear Model
3.2.3. Simulation of Confounded Data
3.3. IV Estimator
3.3.1. Graph Algebra of IV Estimator
3.3.2. Properties of IV Estimator
3.3.3. IV Estimator with Standard Algebra
3.3.4. Simulation of an IV Estimator
3.3.5. IV Estimator with Matrix Algebra
3.3.6. Two-Stage Least Squares
3.3.7. IV Estimator in R
3.3.8. Bootstrap IV Estimator for R
3.4. Returns to Schooling
3.4.1. Distance to College as an Instrument
3.4.2. NLSM Data
3.4.3. Simple IV Estimates of Returns to Schooling
3.4.4. Matrix Algebra IV Estimates of Returns to Schooling
3.4.5. Concerns with Distance to College
3.5. Instrument Validity
3.5.1. Test of Instrument Validity
3.5.2. Test of Instrument Validity in R
3.6. Better LATE than Nothing
3.6.1. Heterogeneous E ects
3.6.2. Local Average Treatment E ect
3.6.3. LATE Estimator
3.6.4. LATE Estimates of Returns to Schooling
3.7. Discussion and Further Reading
4. Bounds Estimation
4.1. Introduction
4.2. Potential Outcomes
4.2.1. Model of Potential Outcomes
4.2.2. Simulation of Impossible Data
4.2.3. Distribution of the Treatment Effect
4.3. Average Treatment Effect
4.3.1. ATE and Its Derivation
4.3.2. ATE and Do Operators
4.3.3. ATE and Unconfoundedness
4.3.4. ATE and Simulated Data
4.4. Kolmogorov Bounds
4.4.1. Kolmogorov's Conjecture
4.4.2. Kolmogorov Bounds in R
4.5. Do ''Nudges" Increase Savings?
4.5.1. Field Experiment Data
4.5.2. Bounds on the Distribution of Balance Changes
4.5.3. Intent To Treat Discussion
4.6. Manski Bounds
4.6.1. Confounded Model
4.6.2. Simulation of Manski Bounds
4.6.3. Bounding the Average Treatment Effect
4.6.4. Natural Bounds of the Average Treatment Effect
4.6.5. Natural Bounds with Simulated Data
4.6.6. Are Natural Bounds Useless?
4.6.7. Bounds with Exogenous Variation
4.6.8. Exogenous Variation in Simulated Data
4.6.9. Bounds with Monotonicity
4.6.10. Bounds with Monotonicity in Simulated Data
4.7. More Guns, Less Crime?
4.7.1. Crime Data
4.7.2. ATE of RTC Laws under Unconfoundedness
4.7.3. Natural Bounds on ATE of RTC Laws
4.7.4. Bounds on ATE of RTC Laws with Exogenous Variation
4.7.5. Bounds on ATE of RTC Laws with Monotonicity
4.8. Discussion and Further Reading
II:
Structural Estimation
5. Estimating Demand
5.1. Introduction
5.2. Revealed Preference
5.2.1. Modeling Demand
5.2.2. Simulating Demand
5.2.3. Revealing Demand
5.3. Discrete Choice
5.3.1. Simple Discrete Choice Model
5.3.2. Simulating Discrete Choice
5.3.3. Modeling Discrete Choice
5.4. Maximum Likelihood
5.4.1. Binomial Likelihood
5.4.2. Binomial Likelihood in R
5.4.3. OLS with Maximum Likelihood
5.4.4. Maximum Likelihood OLS in R
5.4.5. Probit
5.4.6. Probit in R
5.4.7. Generalized Linear Model
5.5. McFadden's Random Utility Model
5.5.1. Model of Demand
5.5.2. Probit and Logit Estimators
5.5.3. Simulation with Probit and Logit Estimators
5.6. Multinomial Choice
5.6.1. Multinomial Choice Model
5.6.2. Multinomial Probit
5.6.3. Multinomial Probit in R
5.6.4. Multinomial Logit
5.6.5. Multinomial Logit in R
5.6.6. Simulating Multinomial Choice
5.7. Demand for Rail
5.7.1. National Household Travel Survey
5.7.2. Demand for Cars
5.7.3. Estimating Demand for Rail
5.7.4. Predicting Demand for Rail
5.8. Discussion and Further Reading
6. Estimating Selection Models
6.1. Introduction
6.2. Modeling Censored Data
6.2.1. A Model of Censored Data
6.2.2. Simulation of Censored Data
6.2.3. Latent Value Model
6.2.4. Tobit Estimator
6.2.5. Tobit Estimator in R
6.3. Censoring Due to Minimum Wages
6.3.1. National Longitudinal Survey of Youth 1997
6.3.2. Tobit Estimates
6.4. Modeling Selected Data
6.4.1. A Selection Model
6.4.2. Simulation of a Selection Model
6.4.3. Heckman Model
6.4.4. Heckman Estimator
6.4.5. Heckman Estimator in R
6.5. Analyzing the Gender Wage Gap
6.5.1. NLSY97 Data
6.5.2. Choosing to Work
6.5.3. Heckman Estimates of Gender Gap
6.6. Back to School Returns
6.6.1. NLSM Data
6.6.2. College vs. No College
6.6.3. Choosing College
6.6.4. Heckman Estimates of Returns to Schooling
6.6.5. Effect of College
6.7. Discussion and Further Reading
7. Demand Estimation with IV
7.1. Introduction
7.2. Modeling Competition
7.2.1. Competition is a Game
7.2.2. Hotelling's Line
7.2.3. Nash Equilibrium
7.3. Estimating Demand in Hotelling's Model
7.3.1. Simulation of Hotelling Model
7.3.2. Prices are Endogenous
7.3.3. Cost Shifters
7.3.4. Demand Shifters
7.4. Berry Model of Demand
7.4.1. Choosing Prices
7.4.2. A Problem with Cost Shifters
7.4.3. Empirical Model of Demand
7.4.4. Inverting Demand
7.4.5. Demand Shifters to Estimate Supply
7.4.6. Demand Estimation from Supply Estimates
7.5. Introduction of Apple Cinnamon Cheerios
7.5.1. Dominick's Data for Cereal
7.5.2. Instrument for Price of Cereal
7.5.3. Demand for Apple Cinnamon Cheerios
7.5.4. Value of Apple Cinnamon Cheerios
7.6. Discussion and Further Reading
8. Estimating Games
8.1. Introduction
8.2. Mixed Strategy Nash Equilibrium
8.2.1. Coaches' Decision Problem
8.2.2. Zero-Sum Game
8.2.3. Nash Equilibrium
8.2.4. Third and Fourth Down Game
8.2.5. Equilibrium Strategies
8.2.6. Equilibrium Strategies in R
8.2.7. Simulation of Third and Fourth Down Game
8.3. Generalized Method of Moments
8.3.1. Moments of OLS
8.3.2. Simulated Moments OLS
8.3.3. GMM OLS Estimator
8.3.4. GMM OLS Estimator in R
8.3.5. GMM of Returns to Schooling
8.4. Estimating the Third Down Game
8.4.1. Moment Conditions
8.4.2. Third Down GMM Estimator in R
8.5. Are NFL Coaches Rational?
8.5.1. NFL Data
8.5.2. Estimating Third Down Game in R
8.5.3. Predicting the Fourth Down Game
8.5.4. Testing Rationality of NFL Coaches
8.6. Discussion and Further Reading
9. Estimating Auction Models
9.1. Introduction
9.2.Sealed Bid Auctions
9.2.1. Sealed Bid Model
9.2.2. Sealed Bid Simulation
9.2.3. Sealed Bid Estimator
9.2.4. Sealed Bid Estimator in R
9.3. English Auctions
9.3.1. Order Statistics
9.3.2. Identifying the Value Distribution
9.3.3. English Auction Estimator
9.3.4. English Auction Estimator in R
9.4. Are Loggers Rational?
9.4.1. Timber Data
9.4.2. Sealed Bid Auctions
9.4.3. English Auctions
9.4.4. Comparing Estimates
9.5. Are Loggers Colluding?
9.5.1. A Test of Collusion
9.5.2. "Large" English Auctions
9.5.3. Large English Auction Estimator
9.5.4. Large English Auction Estimator in R
9.5.5. Evidence of Collusion
9.5.6. Large Sealed Bid Auction Estimator
9.5.7. Large Sealed Bid Auction Estimator in R
9.6. Discussion and Further Reading
III:
Repeated Measurement
10. Panel Data
10.1. Introduction
10.2. First Differences
10.2.1. First Di erence Model
10.2.2. Simulated Panel Data
10.2.3. OLS Estimation of First Differences
10.3. Difference in Difference
10.3.1. Difference in Difference Estimator
10.3.2. Difference in Difference Estimator in R
10.4. Minimum Wage Increase in New Jersey
10.4.1. Data from Card and Krueger (1994)
10.4.2. Difference in Difference Estimates
10.5. Fixed Effects
10.5.1. Fixed E ects Estimator
10.5.2. Nuisance Parameter
10.5.3. Adjusted Fixed Effects Estimator
10.5.4. Two Step Fixed Effects Estimator
10.5.5. Fixed E ects Estimator in R
10.6. Effect of a Federal Minimum Wage Increase
10.6.1. NLSY97
10.6.2. Fixed E ects Estimators of the Minimum Wage
10.6.3. Are Workers Better Off?
10.7. Discussion and Further Reading
11. Synthetic Controls
11.1. Introduction
11.2. Beyond ''Parallel Trends"
11.2.1. A General Fixed E ects Model
11.2.2. A Slightly Less General Model
11.2.3. Synthetic Synthetic Control Data
11.2.4. Constructing Synthetic Controls with OLS
11.2.5. OLS Weights in R
11.2.6. A"wide" Data Problem
11.3. Abadie Estimator
11.3.1. Restricting Weights
11.3.2. Synthetic Control Estimator in R
11.4. Regularization
11.4.1. Turducken Estimation
11.4.2. LASSO
11.4.3. LASSO in R
11.5. Factor Models
11.5.1. Matrix Factorization
11.5.2. Convex Matrix Factorization
11.5.3. Synthetic Controls using Factors
11.5.4. Estimating the Weights
11.5.5. Convex Factor Model Estimator in R
11.6. Returning to Minimum Wage E ects
11.6.1. NLSY97 Data
11.6.2. Synthetic Control Estimates
11.6.3. LASSO Estimates
11.6.4. Factor Model Estimates
11.7. Discussion and Further Reading
12. Mixture Models
12.1. Introduction
12.2. Two-Type Mixture Models
12.2.1. Simulation of Two-Type Mixture
12.2.2. Knowing the Component Distributions
12.2.3. Observing Multiple Signals
12.3. Two Signal Mixture Models
12.3.1. Model of Two Signal Data
12.3.2. Simulation of Two Signal Data
12.3.3. Conditional Independence of Signals
12.3.4. Two Signal Estimator
12.3.5. Two Signal Estimator Algorithm
12.3.6. Mixture Model Estimator in R
12.4. Twins Reports and Returns to Schooling
12.4.1. Mixture Model of Twin Reports
12.4.2. Twin Reports Data
12.4.3. Mixture Model Approach to Measurement Error
12.4.4. Estimating Returns to Schooling from Twins
12.5. Revisiting Minimum Wage Effects
12.5.1. Restaurant Employment
12.5.2. Mixture Model Estimation of Restaurant Type
12.5.3. Heterogeneous Minimum Wage Effect
12.6. Discussion and Further Reading
IV:
Appendices
A. Measuring Uncertainty
A.1. Introduction
A.2. Classical Statistics
A.2.1. A Model of a Sample
A.2.2. Simulation of a Sample
A.2.3. Many Imaginary Samples
A.2.4. Law of Large Numbers
A.2.5. Central Limit Theorem
A.2.6. Approximation of the Limiting Distribution
A.2.7. Simulation of Approximate Distributions
A.2.8. Bootstrap
A.2.9. Hypothesis Testing
A.3. Bayesian Statistics
A.3.1. Bayes' Rule
A.3.2. Determining the Posterior
A.3.3. Determining the Posterior in R
A.4. Empirical Bayesian Estimation
A.4.1. A Large Number of Samples
A.4.2. Solving for the Prior and Posterior
A.4.3. Solving for the Prior in R
A.4.4. Estimating the Posterior of the Mean
A.5. The Sultan of the Small Sample Size
A.5.1. Classical or Bayesian?
A.5.2. Uniform Prior
A.5.3. Estimating the Prior
A.5.4. Paciorek's Posterior
A.6. Decision Theory
A.6.1. Decision Making Under Uncertainty
A.6.2. Compound Lotteries
A.6.3. What in the World Does Wald Think?
A.6.4. Two Types of Uncertainty?
A.7. Discussion and Further Reading
B. Statistical Programming in R
B.1. Introduction
B.2. Objects in R
B.2.1. Vectors
B.2.2. Matrices
B.2.3. Lists
B.2.4. Data Frames
B.3. Interacting with Objects
B.3.1. Transforming Objects
B.3.2. Logical Expressions
B.3.3. Retrieving Information from a Position
B.3.4. Retrieving the Position from the Information
B.4. Statistics
B.4.1. Data
B.4.2. Missing Values
B.4.3. Summary Statistics
B.4.4. Regression
B.5. Control
B.5.1. Loops
B.5.2. Looping in R
B.5.3. If Else
B.6. Optimization
B.6.1. Functions
B.6.2. optim()
B.7. Discussion and Further Reading
Note
Bibliography
Author index
Subject index