View source: R/treated_untreated_diagnostic.R
| compare_treated_observations | R Documentation |
For a fitted PanelMatch object, identifies treated unit-times that
did and did not receive at least one matched control unit, and compares
their average pre-treatment covariate values over the matching lag window.
This serves as a diagnostic for whether treated observations that
successfully matched are systematically different from those that did
not, which has implications for the generalizability of the estimated
treatment effect to the full set of treated observations.
compare_treated_observations(pm.object, panel.data, covariates)
pm.object |
A |
panel.data |
A |
covariates |
A character vector of covariate names (columns in
|
For each covariate, the comparison is computed within each treatment cohort (i.e., treated unit-times sharing the same treatment time) that contains both matched and unmatched treated units. Within a cohort, the covariate is averaged over the full lag window for matched units and, separately, for unmatched units; the difference between these two averages is computed; and the resulting per-cohort differences are then aggregated across all valid cohorts two ways: an unweighted average that gives equal weight to each cohort regardless of size, and a weighted average that weights each cohort by its number of treated units.
This function returns a plain list (no class) – see
diagnostic_summary for a formatted report built on top of
it.
A plain list (no class) with the following components:
Number of treated unit-times with at least one matched control.
Number of treated unit-times with no matched control.
Percentage of all treated unit-times that had no
matched control (n_no_match divided by the total number of
treated unit-times).
Number of unmatched treated unit-times whose treatment cohort contains no matched treated units at all, i.e. no viable basis for comparison.
Percentage of unmatched treated unit-times
(n_no_match) that had no viable comparison cohort
(n_no_viable divided by n_no_match).
A data.frame with one row per
covariate, giving the unweighted average difference (matched
minus unmatched) in pre-treatment covariate values across
treatment cohorts (mean_diff), and the same difference
weighted by cohort size (weighted_mean_diff). NULL
if no cohort contained both matched and unmatched treated units.
## Not run:
PM.results <- PanelMatch(panel.data = dem.sub.panel, lag = 4,
refinement.method = "ps.match",
match.missing = TRUE,
covs.formula = ~ tradewb,
size.match = 5, qoi = "att",
lead = 0:4,
forbid.treatment.reversal = FALSE)
result <- compare_treated_observations(PM.results, dem.sub.panel,
covariates = c("tradewb", "y"))
str(result)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.