-
Notifications
You must be signed in to change notification settings - Fork 68
Description
I’m running into an issue reproducing the standard errors for the two-way fixed effects DiD specification in the organ donation example.
Using the code below exactly as written, I obtain the same point estimate for the treatment effect, but standard errors that are roughly 3× larger than those reported in the book. The reported standard errors only match the book when I explicitly specify clustering by State. Could this be due to a change in the default behaviour of feols(), or to some environment-specific setting?
Suggestion: it may be helpful to add vcov = ~State directly to the replication code so that the reported standard errors align with the table note and the book’s results without requiring users to infer the clustering choice.
Snippet from causalbook/DifferenceinDifferences/differenceindifferences.R
# Regression model
m <- feols(I(rate/100)~ Treatment | State + Quarter,
data = d %>% mutate(Treatment = st & qtr > ymd('2011-07-01')) %>% rename(Quarter = qtr))
Snippet from causalbook/DifferenceinDifferences/differenceindifferences.R
library(tidyverse); library(modelsummary); library(fixest)
od <- causaldata::organ_donations
# Treatment variable
od <- od %>%
mutate(Treated = State == 'California' &
Quarter %in% c('Q32011','Q42011','Q12012'))
# feols clusters by the first
# fixed effect by default, no adjustment necessary
clfe <- feols(Rate ~ Treated | State + Quarter,
data = od)
The reported standard errors only match the book when I explicitly specify clustering:
m <- feols(
I(rate/100) ~ Treatment | State + Quarter,
data = d %>%
mutate(Treatment = st & qtr > ymd("2011-07-01")) %>%
rename(Quarter = qtr),
vcov = ~State
)