powered by
Estimates DiD for count outcomes using a Poisson quasi-maximum likelihood (QMLE) estimator with a log-linear parallel trends assumption. The treatment effect is a multiplicative rate ratio.
count_did_poisson( data, yname, tname, idname, treat_period, control_period, dname = NULL, gname = NULL, xformla = ~1, offset = NULL, se_type = c("robust", "cluster", "analytical"), cluster_var = NULL )
A list of class count_did_poisson.
count_did_poisson
A data frame (long format).
Character. Binary outcome variable name.
Character. Time period variable name.
Character. Unit ID variable name.
Numeric. The treatment (post) period.
Numeric. The pre-treatment baseline period.
Character. Treatment indicator variable name (optional).
Character. Cohort variable name (optional).
One-sided formula for covariates. Default ~1.
~1
Character. Name of offset variable. Default NULL.
NULL
Character. SE type: "robust" (default), "cluster", or "analytical".
"robust"
"cluster"
"analytical"
Character. Clustering variable (if se_type = "cluster").
se_type = "cluster"
dat <- sim_count_panel(n = 400, nperiods = 6, prop_treated = 0.4) dat2 <- dat[dat$period %in% c(2, 4), ] res <- count_did_poisson(dat2, "y", "period", "id", 4, 2, gname = "g") print(res)
Run the code above in your browser using DataLab