| binary_did_logit | R Documentation |
Estimates a 2x2 difference-in-differences model with a binary outcome using logistic regression on the log-odds scale, reporting both the log-odds DiD coefficient and the average partial effect (APE) on the probability scale.
binary_did_logit(
data,
yname,
tname,
idname,
treat_period,
control_period,
dname = NULL,
gname = NULL,
xformla = ~1,
se_type = c("robust", "cluster", "analytical"),
cluster_var = NULL
)
data |
A data frame (long format). |
yname |
Character. Binary outcome variable name. |
tname |
Character. Time period variable name. |
idname |
Character. Unit ID variable name. |
treat_period |
Numeric. The treatment (post) period. |
control_period |
Numeric. The pre-treatment baseline period. |
dname |
Character. Treatment indicator variable name (optional). |
gname |
Character. Cohort variable name (optional). |
xformla |
One-sided formula for covariates. Default |
se_type |
Character. SE type: |
cluster_var |
Character. Clustering variable (if |
A list of class binary_did_logit.
dat <- sim_binary_panel(n = 500, nperiods = 4, prop_treated = 0.5)
dat2 <- dat[dat$period %in% c(2, 3), ]
res <- binary_did_logit(dat2, yname = "y", tname = "period",
idname = "id", treat_period = 3,
control_period = 2, gname = "g")
print(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.