Learning Microeconometrics with R
Preface
Prerequisites
Introduction
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.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.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
Plotting Returns to Schooling
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.6
Are Bankers Racist or Greedy?
2.6.1
Boston HDMA 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
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 Esimator with Matrix Algebra
3.3.6
Two-Stage Least Squares
3.3.7
IV Estimator in R
3.4
Returns to schooling
4
Bounds Estimation
5
Estimating Demand
6
Estimating Selection Models
6.1
Introduction
6.2
Modelling Censored Data
6.2.1
A Model of Censored Data
6.2.2
Simulation of Censored Data
6.2.3
6.4.2 Simulation of a selection model
6.2.4
Heckman estimator in R
6.3
Analysing the Gender Wage Gap
6.3.1
NLSY97 data
7
Demand Estimation with IV
8
Estimating Games
9
Estimating Auction Models
10
Panel Data
10.1
First differences
10.1.1
First difference model
10.1.2
Simulated panel data
10.1.3
OLS estimation of first differences
10.2
Difference in difference
10.2.1
Difference-in-difference estimator
10.2.2
Difference-in-difference estimator in R
10.3
Minimum wage increase in New Jersey
10.3.1
Data from Card and Krueger (1994)
10.3.2
Difference-in-Difference Estimates
10.4
Fixed Effects
10.4.1
Fixed-Effects Estimator
10.4.2
Nuisance Parameter
10.4.3
Adjusted Fixed-Effects Estimator
10.4.4
Two-Step Fixed-Effects Estimator
10.4.5
Fixed Effects Estimator in R
Published with bookdown
Learning Microeconometrics with R: The tidyverse version
Chapter 4
Bounds Estimation