% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/estimators.R
\name{odds_ratio_did}
\alias{odds_ratio_did}
\title{Odds-Ratio DiD for Binary Outcomes}
\usage{
odds_ratio_did(
  data,
  yname,
  tname,
  idname,
  treat_period,
  control_period,
  dname = NULL,
  gname = NULL,
  xformla = ~1
)
}
\arguments{
\item{data}{A data frame (long format).}

\item{yname}{Character. Binary outcome variable name.}

\item{tname}{Character. Time period variable name.}

\item{idname}{Character. Unit ID variable name.}

\item{treat_period}{Numeric. The treatment (post) period.}

\item{control_period}{Numeric. The pre-treatment baseline period.}

\item{dname}{Character. Treatment indicator variable name (optional).}

\item{gname}{Character. Cohort variable name (optional).}

\item{xformla}{One-sided formula for covariates. Default \code{~1}.}
}
\value{
A list of class \code{odds_ratio_did}.
}
\description{
Estimates the odds-ratio difference-in-differences (OR-DiD) for binary
outcomes. OR-DiD equals 1 under no treatment effect and is invariant to
which group is labelled treatment.
}
\examples{
dat <- sim_binary_panel(n = 500, nperiods = 4, prop_treated = 0.5)
dat2 <- dat[dat$period \%in\% c(2, 3), ]
res <- odds_ratio_did(dat2, "y", "period", "id", 3, 2, gname = "g")
print(res)
}
