View source: R/mDid_weights_CH.R
mDid_weights_CH | R Documentation |
Weights from Chaisemartin and Hautefeuille (2020)
mDid_weights_CH(
data,
y_var = "y",
time.index = "Time",
treat = "tr",
unit.index = "unit",
return_details = FALSE
)
## S3 method for class 'FE_weights_CH'
print(x, ...)
## S3 method for class 'FE_weights_CH'
plot(x, by = c("time", "unit"), ...)
weights_CH_smry(data)
data |
A data frame containing the variables of interest, should have names |
y_var |
The name of the y variable |
time.index |
The name of the variable describing the time index (date, year, etc) |
treat |
The name of the treatment variable. |
unit.index |
The name of the units (individual, county, household, etc). |
return_details |
Return additional details on weights? |
x |
Output from |
by |
Which kind of plot to draw |
... |
Unused arguments |
A enhanced tibble
of class FE_weights_CH
The weight w_{g,t}
as defined in the paper
The weight w multiplied by obs_weight
. They sum to 1.
The ratio N_{g,t}/N_1
, eventually including also the treatment intensity.
de Chaisemartin and D'Haultfoeuille (2020), Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects American Economic Review , Vol. 110, No. 9
mdd_estim_CH
for the CH estimators and GentzkowData
for a presentation of the Gentzkow datasets
## example from page 2970 in Chaisemartin and Hautefeuille (2020)
examp_df <- data.frame(unit = rep(c(1, 2), each=3),
Time = rep(1:3, 2),
treat = c(0, 0, 1, 0, 1, 1))
w_df <- mDid_weights_CH(examp_df, treat = "treat",
time.index = "Time")
w_df
## the three weights shown in the beta^FE equation:
subset(as.data.frame(w_df), treat==1, "weight")
## replicate application B of Gentzkow, Shapiro, and Sinkinson (2011)
data(GentzkowData)
data_W_CH <- mDid_weights_CH(data=GentzkowData,
y_var="prestout",
time.index = "year",
treat = "numdailies",
unit.index="cnty90")
## results are a bit different compared to the paper:
data_W_CH
plot(data_W_CH, by = "unit")
plot(data_W_CH, by = "time")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.