Skip to contents

The `didet()` function takes the effective treatment approach to difference-in-differences estimation with general treatment patterns. The method is developed by Yanagi (2023). For more details, see the package vignette with `vignette("didet")` and `vignette("review", package = "didet")`.

Usage

didet(
  yname,
  dname,
  tname,
  idname,
  xformla = ~1,
  data,
  specification = "event",
  alp = 0.05,
  nboot = 1000
)

Arguments

yname

The name of the outcome variable

dname

The name of the treatment variable

tname

The name of the time period

idname

The name of the unit index

xformla

A formula for the unit-specific covariates to be included. It should be of the form `xformla = ~ X1 + X2`. Default is `xformla = ~ 1`.

data

A data.frame of balanced panel data (long format)

specification

A character specifying the effective treatment function. Options are "once", "event", "number", and "aggregate". Default is "event".

alp

The significance level. Default is 0.05.

nboot

The number of bootstrap repetitions. Default is 1000.

Value

A list that contains the following elements.

ATEM

A data.frame that collects results for ATEM(t,s,e)

mover

A data.frame that collects results for the probability of mover

stayer

A data.frame that collects results for the probability of stayer

figure

A list that contains the ggplot2 figures for ATEM(t,s,e)

References

Yanagi, T., 2023. An effective treatment approach to difference-in-differences with general treatment patterns. arXiv:2212.13226.

Examples

set.seed(1)
data <- datageneration(N = 1000, S = 4)
did_est <- didet(yname = "Y",
                 dname = "D",
                 tname = "period",
                 idname = "id",
                 xformla = ~ X,
                 data = data,
                 specification = "event",
                 alp = 0.05,
                 nboot = 1000)