Heterogeneity-robust DiD by sub-group / moderator quantile
Source:R/did.R
morie_did_heterogeneous.RdSplits the sample by quantiles (or categories) of a moderator and estimates separate 2x2 DiDs.
Usage
morie_did_heterogeneous(
data,
outcome,
treatment,
post,
moderator,
covariates = NULL,
cluster = NULL,
n_quantiles = 4L,
alpha = 0.05
)Arguments
- data
A data frame containing the outcome, treatment, post and any covariate columns.
- outcome
Name of the outcome column.
- treatment
Name of the binary (0/1) treatment-group column.
- post
Name of the binary (0/1) post-period column.
- moderator
Column to split on.
- covariates
Optional character vector of covariate column names.
- cluster
Optional cluster ID column for CR1 standard errors.
- n_quantiles
Number of quantile bins if the moderator is continuous.
- alpha
Significance level for confidence intervals (default 0.05).