% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/event_study.R
\name{mb_event_study}
\alias{mb_event_study}
\title{Simple event-study coefficients}
\usage{
mb_event_study(
  y,
  unit,
  time,
  treatment_time,
  treated,
  leads = 3L,
  lags = 3L,
  cluster = NULL,
  quiet = FALSE
)
}
\arguments{
\item{y}{Numeric vector of outcomes.}

\item{unit}{Vector identifying units (panel ID).}

\item{time}{Numeric vector of time indices.}

\item{treatment_time}{Numeric scalar. The first treated period.
Units with \code{treated = 0} (never-treated) are pure controls.}

\item{treated}{Logical or 0/1 numeric vector indicating
whether each observation belongs to a treated unit. The design
requires at least some never-treated control units; without
them the event-time dummies are collinear with the time fixed
effects.}

\item{leads}{Integer >= 0. Number of pre-treatment periods to
include. Default \code{3}.}

\item{lags}{Integer >= 0. Number of post-treatment periods.
Default \code{3}.}

\item{cluster}{Optional vector identifying clusters for
cluster-robust standard errors (CR1 with finite-sample
correction \code{(G/(G-1)) * (N-1)/(N-K)}). Common choice: pass
\code{unit} to cluster at the unit level. If \code{NULL} (default),
conventional OLS SEs are returned.}

\item{quiet}{Logical. If \code{FALSE} (default), the print method
appends a one-line reminder that this is a fixed-treatment-
time event study and points to \pkg{fixest} (\code{sunab()}) or
\pkg{did} for staggered adoption. Set to \code{TRUE} to suppress.}
}
\value{
An \code{mb_event_study} object: a list with \code{event_time},
\code{estimate}, \code{se}, plus \code{n}, \code{n_units}, \code{n_periods},
\code{treatment_time}, and \code{vintage}.
}
\description{
Estimates a panel event-study with unit and time fixed effects
and event-time dummies. Treatment time is fixed across treated
units (no staggered adoption). Returns coefficients for \code{leads}
periods before and \code{lags} periods after treatment, with the
period immediately before treatment (\code{event_time = -1}) omitted
as the reference category.
}
\details{
Implements the canonical two-way fixed-effects event study:
\deqn{Y_{it} = \alpha_i + \gamma_t + \sum_{k \neq -1} \beta_k \mathbf{1}\{t - t^* = k, D_i = 1\} + \epsilon_{it}}

For staggered adoption (units treated at different times), this
specification is biased under treatment-effect heterogeneity. Use
the heterogeneity-robust estimators of Callaway & Sant'Anna
(2021) or de Chaisemartin & D'Haultfoeuille (2020), available in
the \pkg{did}, \pkg{didimputation}, or \pkg{fixest} packages
(\code{fixest::feols} with \code{sunab()}).

Standard errors are conventional OLS; for clustered inference
use \pkg{sandwich} or \pkg{fixest}.
}
\examples{
set.seed(3)
n_units <- 50; n_periods <- 10; treat_time <- 6
panel <- expand.grid(unit = 1:n_units, time = 1:n_periods)
panel$treated <- as.integer(panel$unit <= 25)
panel$post    <- as.integer(panel$time >= treat_time)
panel$y <- 0.1 * panel$time + 0.5 * (panel$treated * panel$post) +
           rnorm(nrow(panel))
mb_event_study(
  y = panel$y, unit = panel$unit, time = panel$time,
  treatment_time = treat_time, treated = panel$treated,
  leads = 3, lags = 3
)
}
\references{
Callaway, B., Sant'Anna, P. H. C. (2021). Difference-in-Differences
with Multiple Time Periods. Journal of Econometrics 225(2).
\url{doi:10.1016/j.jeconom.2020.12.001}.

de Chaisemartin, C., D'Haultfoeuille, X. (2020). Two-Way Fixed
Effects Estimators with Heterogeneous Treatment Effects. American
Economic Review 110(9). \url{doi:10.1257/aer.20181169}.
}
\seealso{
\code{\link[=mb_did_2x2]{mb_did_2x2()}}, \code{\link[=mb_its]{mb_its()}}.

Other estimators: 
\code{\link{mb_did_2x2}()},
\code{\link{mb_its}()}
}
\concept{estimators}
