19.5 Example: Insurance takeup
- rural China
- households randomly informed about insurance
- default 1: only information
- default 2: information & buy insurance
How much does your friends buying insurance affect your own takeup of insurance?
- adding FE
- easy with
fixest - more difficult with
gmm–> add as factor
- easy with
19.5.1 2SLS
# There are many ways to run 2SLS;
# the most common is ivreg from the AER package.
# But we'll use feols from fixest for speed and ease
# of fixed-effects additions later
library(tidyverse); library(modelsummary); library(fixest)
d <- causaldata::social_insure
# Include just the outcome and controls first, then endogenous ~ instrument
# in the second part, and for this study we cluster on address
m <- feols(takeup_survey ~ male + age + agpop + ricearea_2010 +
literacy + intensive + risk_averse + disaster_prob +
factor(village) | pre_takeup_rate ~ default,
cluster = ~address, data = d)
# Show the first and second stage, omitting all
# the controls for ease of visibility
msummary(list('First Stage' = m$iv_first_stage[[1]],
'Second Stage' = m),
coef_map = c(default = 'First Round Default',
fit_pre_takeup_rate = 'Friends Purchase Behavior'),
stars = c('*' = .1, '**' = .05, '***' = .01))| First Stage | Second Stage | |
|---|---|---|
| * p < 0.1, ** p < 0.05, *** p < 0.01 | ||
| First Round Default | 0.118*** | |
| (0.034) | ||
| Friends Purchase Behavior | 0.791*** | |
| (0.273) | ||
| Num.Obs. | 1378 | 1378 |
| R2 | 0.469 | 0.127 |
| R2 Adj. | 0.448 | 0.092 |
| AIC | -775.7 | 1911.4 |
| BIC | -498.6 | 2188.5 |
| RMSE | 0.18 | 0.47 |
| Std.Errors | by: address | by: address |
19.5.2 GMM
library(modelsummary); library(gmm)
d <- causaldata::social_insure
# Remove all missing observations ourselves
d <- d %>%
select(takeup_survey, male, age, agpop, ricearea_2010,
literacy, intensive, risk_averse, disaster_prob,
village, address, pre_takeup_rate, default) %>%
na.omit()
m <- gmm(takeup_survey ~ male + age + agpop + ricearea_2010 +
literacy + intensive + risk_averse + disaster_prob +
factor(village) + pre_takeup_rate,
~ male + age + agpop + ricearea_2010 +
literacy + intensive + risk_averse + disaster_prob +
factor(village) + default, data = d)
# We can apply the address clustering most easily in msummary
msummary(m,
vcov = ~address,
stars = c('*' = .1, '**' = .05, '***' = .01),
coef_map = "pre_takeup_rate")| (1) | |
|---|---|
| * p < 0.1, ** p < 0.05, *** p < 0.01 | |
| pre_takeup_rate | 0.791*** |
| (0.251) | |
| Num.Obs. | 1378 |
| Std.Errors | by: address |