Adds a third differencing dimension to the standard DiD specification.
Usage
morie_did_triple_difference(
data,
outcome,
treatment,
post,
third_diff,
covariates = NULL,
cluster = NULL,
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.
- third_diff
Binary variable defining the additional differencing group.
- covariates
Optional character vector of covariate column names.
- cluster
Optional cluster ID column for CR1 standard errors.
- alpha
Significance level for confidence intervals (default 0.05).
Value
A result list; see morie_did_2x2.
Examples
set.seed(1)
n <- 400
d <- rbinom(n, 1, 0.5); p <- rbinom(n, 1, 0.5)
s <- rbinom(n, 1, 0.5)
y <- 0.2 * d + 0.3 * p + 0.4 * s + 0.5 * d * p * s + rnorm(n, sd = 0.5)
df <- data.frame(y = y, d = d, post = p, group = s)
res <- morie_did_triple_difference(df, "y", "d", "post", "group")
res$estimate
#> [1] 0.466752
