mDid_weights_CH: Weights from Chaisemartin and Hautefeuille (2020)

View source: R/mDid_weights_CH.R

mDid_weights_CHR Documentation

Weights from Chaisemartin and Hautefeuille (2020)

Description

Weights from Chaisemartin and Hautefeuille (2020)

Usage

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)

Arguments

data

A data frame containing the variables of interest, should have names y_var, treat, time.index and unit.index

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 mDid_weights_CH

by

Which kind of plot to draw

...

Unused arguments

Value

A enhanced tibble of class FE_weights_CH

w

The weight w_{g,t} as defined in the paper

weight

The weight w multiplied by obs_weight. They sum to 1.

obs_weight

The ratio N_{g,t}/N_1, eventually including also the treatment intensity.

References

de Chaisemartin and D'Haultfoeuille (2020), Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects American Economic Review , Vol. 110, No. 9

See Also

mdd_estim_CH for the CH estimators and GentzkowData for a presentation of the Gentzkow datasets

Examples

## 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")

MatthieuStigler/multiDiff documentation built on Feb. 14, 2025, 12:02 a.m.