
Subclassification (stratification) on the propensity score
Source:R/matching.R
morie_matching_subclassify.RdNative propensity-score subclassification with the rules of
MatchIt::matchit(method = "subclass", estimand = "ATT"): the cut points are
quantiles of the treated units' scores, every unit falls in the subclass of
its score, and a subclass left without a treated or a control unit takes the
nearest unit of that group from the closest subclass that can spare one
("scooting", MatchIt's min.n = 1). Weights are 1 for treated units and the
treated/control ratio of the subclass for controls, each group rescaled to
its size. Cross-validated against MatchIt in tests/cross. No MatchIt at
runtime.
Arguments
- data
Data frame.
- treatment
Binary treatment column name.
- covariates
Character vector of covariates.
- ps
Optional propensity scores (as for
morie_matching_full()).- n_strata
Number of quantile-based strata (default 5).
Value
A list with components data_with_strata (the data with
distance, weights, subclass, ._ps and
._stratum columns) and stratum_effects (per-stratum sample
sizes and propensity-score ranges).
Examples
set.seed(1)
df <- data.frame(y = rnorm(200), d = rbinom(200, 1, 0.4),
x1 = rnorm(200), x2 = rnorm(200))
morie_matching_subclassify(df, "d", c("x1", "x2"), n_strata = 5)$stratum_effects
#> stratum n_treated n_control ps_range_low ps_range_high
#> 1 1 18 27 0.2956479 0.3927630
#> 2 2 17 24 0.3934888 0.4238873
#> 3 3 17 24 0.4244656 0.4584856
#> 4 4 17 23 0.4596167 0.4877596
#> 5 5 18 15 0.4894480 0.5805204