mdd_event_study: Event study

View source: R/Event_study.R

mdd_event_studyR Documentation

Event study

Description

Event study

Usage

mdd_event_study(
  mdd_dat,
  trim_low = NULL,
  trim_high = NULL,
  time.omit = -1,
  weights = NULL,
  cluster = NULL,
  ...
)

## S3 method for class 'mdd_event_study'
plot(x, ...)

Arguments

mdd_dat

An object of class mdd_dat created by mdd_data_format

trim_low, trim_high

Upper/lower bound on parameters to include

time.omit

Which is the base year omitted in the analysis?

weights

Weight argument passed to the underlying feols function

cluster

Cluster argument passed to the underlying feols function

...

passed to feols for mdd_event_study

x

the ES object

Details

This function uses lags of pre/post treatment, omitting the lag -1 (can be changed with time.omit). The interpretation of the event-study coefficient is then the following: each coefficient represents the value of a DiD relating the treated/control difference at relative year -3, -2, 1, 2 to the treated/control difference at relative year -1.

See Also

mdd_test_pre_trend_event to run a parallel trend assumption

Examples

## simulate and format data
DID_dat <- sim_dat_common(timing_treatment = 5:10, as_mdd = TRUE)

## Estimate DiD
mdd_DD_simple(DID_dat)

## estimate ES
ES_out <- mdd_event_study(DID_dat)
ES_out
summary(ES_out)
plot(ES_out)

## compare to year-t- base year diff-diffs:
means_manu <- DID_dat |>
  mdd_group_means() |>
  as.data.frame() |>
  reshape(idvar = "Time",timevar = ".group",
          direction = "wide")
diff_by_period <- means_manu$y.treated - means_manu$y.control
  all.equal((diff_by_period - diff_by_period[5])[-5],
            coef(ES_out), check.attributes= FALSE)

MatthieuStigler/multiDiff documentation built on Oct. 21, 2023, 8:13 a.m.