
DiNardo-Fortin-Lemieux reweighting: composition and structure without a linear model
Source:R/disparity_decomposition.R
morie_dfl_reweight.RdGroup 0 is reweighted by \(\psi(x) = m_1(x)/m_0(x)\), the ratio of the
two groups' masses at each covariate value. The reweighted group has
group 1's covariate distribution exactly
(Research.P15Reweight.reweighting_matches, reweighted_mass),
so its outcome mean is the counterfactual "group 1's composition at group
0's structure" (counterfactual_outcome), and the raw gap splits
into structure \(m_1 - m_{cf}\) and composition \(m_{cf} - m_0\)
(decomposition). Common support is required: a covariate value
present in group 1 but absent from group 0 is an error.
Arguments
- group
Logical or 0/1:
TRUEfor group 1 (whose composition is imposed),FALSEfor group 0 (reweighted).- x
Discrete covariate (a vector; combine several with
interaction()).- y
Outcome.
- weights
Optional non-negative weights.
Value
A list with mean_1, mean_0, counterfactual,
structure, composition, psi (a data frame with
x, mass_1, mass_0, psi),
max_composition_gap (largest difference between the reweighted
and group-1 covariate shares; zero by the theorem) and theorems.
Examples
g <- c(rep(TRUE, 6), rep(FALSE, 6))
x <- c("a", "a", "a", "a", "b", "b", "a", "a", "b", "b", "b", "b")
y <- c(10, 12, 11, 13, 20, 22, 8, 9, 15, 16, 14, 17)
r <- morie_dfl_reweight(g, x, y)
c(mean_1 = r$mean_1, mean_0 = r$mean_0, cf = r$counterfactual, structure = r$structure, composition = r$composition)
#> mean_1 mean_0 cf structure composition
#> 14.666667 13.166667 10.833333 3.833333 -2.333333