Skip to contents

This page sketches the methodology behind ineqx. Three equations carry the intuition; for the full derivations see Rosche (2026).

1. Descriptive within/between decomposition

Take the vector YtY_t of individual incomes at time tt, and the vector GtG_t of group memberships (Gt=jG_t = j for j=1,,Jj = 1,\dots,J mutually exclusive groups). The variance of YtY_t splits cleanly into a within- and a between-group part:

Vt=jπjtσjt2within Wt+jπjt(μjtμt)2between Bt\begin{equation} V_t \;=\; \underbrace{\sum_j \pi_{jt}\,\sigma_{jt}^2}_{\text{within } W_t} \;+\; \underbrace{\sum_j \pi_{jt}\,\big(\mu_{jt} - \bar\mu_t\big)^2}_{\text{between } B_t} \tag{1} \end{equation}

with πjt\pi_{jt} the share of group jj, μjt\mu_{jt} its mean, σjt2\sigma_{jt}^2 its variance, and μt=jπjtμjt\bar\mu_t = \sum_j \pi_{jt}\mu_{jt} the overall mean. Cross sections collapse to a single tt. With repeated cross-sections, the change VtVt0V_t - V_{t_0} further decomposes into contributions from changing means (Δμ)(\Delta_\mu), changing dispersions (Δσ)(\Delta_\sigma), and changing group shares (Δπ)(\Delta_\pi), with each component split into its between- and within-group share. This is what ineqx() returns when no treat is supplied — it is essentially the Western & Bloome (2009) decomposition with a Shapley-averaged path.

2. Causal cross-sectional decomposition

Let D{0,1}D \in \{0,1\} be a binary treatment, βj\beta_j its causal effect on group jj’s mean, and λj\lambda_j its causal effect on group jj’s log-SD (so the treated SD is σj(0)eλj\sigma_j(0)\cdot e^{\lambda_j}). The treatment effect on inequality, τ=V[Y(1)D]V[Y(0)D]\tau = V[Y(1)\mid D] - V[Y(0)\mid D], splits into a between- and a within-group part, and each of those further splits into a heterogeneity and a covariance term:

τB=Varπ(β)hetB+2Covπ(μ(0),β)covBτW2σ2(0)λhetW+2Covπ(σ2(0),λ)covW\begin{equation} \boxed{\;\tau_B \;=\; \underbrace{\mathrm{Var}_\pi(\beta)}_{\text{het}_B} \;+\; \underbrace{2\,\mathrm{Cov}_\pi(\mu(0),\,\beta)}_{\text{cov}_B} \;} \qquad \boxed{\;\tau_W \;\approx\; \underbrace{2\,\bar\sigma^2(0)\,\bar\lambda}_{\text{het}_W} \;+\; \underbrace{2\,\mathrm{Cov}_\pi(\sigma^2(0),\,\lambda)}_{\text{cov}_W}\;} \tag{2} \end{equation}

The four sub-components have direct substantive readings:

  • hetB=Varπ(β)0\text{het}_B = \mathrm{Var}_\pi(\beta) \ge 0. Heterogeneity in the treatment effect on the mean always widens between-group inequality. Equal β\beta across groups means hetB=0\text{het}_B = 0.
  • covB=2Covπ(μ(0),β)\text{cov}_B = 2\,\mathrm{Cov}_\pi(\mu(0),\beta). Sorting of gains. If positive, larger gains accrue to already-advantaged groups (reinforces the hierarchy). If negative, treatment compresses the hierarchy.
  • hetWλ\text{het}_W \propto \bar\lambda. The average effect on within-group dispersion. Sign tracks λ\bar\lambda: treatment can stretch or compress within-group spread.
  • covW=2Covπ(σ2(0),λ)\text{cov}_W = 2\,\mathrm{Cov}_\pi(\sigma^2(0),\lambda). Sorting of variance effects. If positive, treatment amplifies dispersion most in already-disperse groups.

plot(<causal>, type = "wibe", stats = c("het_b","cov_b","het_w","cov_w")) shows these four series directly.

The package supports both VV (variance) and CV2=σ2/μ2CV^2 = \sigma^2/\mu^2 (squared coefficient of variation) as the underlying inequality measure.

3. Longitudinal three-channel decomposition

With repeated cross-sections, the change in the treatment effect on inequality, Δτ=τtτt0\Delta\tau = \tau_t - \tau_{t_0}, decomposes into three interpretable channels:

Δτ=(Δβ+Δλ)behavioral+(Δπ,B+Δπ,W)compositional+(Δμ+Δσ)pre-treatment\begin{equation} \Delta\tau \;=\; \underbrace{(\Delta_\beta + \Delta_\lambda)}_{\text{behavioral}} \;+\; \underbrace{(\Delta_{\pi,B} + \Delta_{\pi,W})}_{\text{compositional}} \;+\; \underbrace{(\Delta_\mu + \Delta_\sigma)}_{\text{pre-treatment}} \tag{3} \end{equation}

  • Behavioral — changes in how treatment affects each group’s mean and variance (Δβ\Delta_\beta, Δλ\Delta_\lambda). The Kitagawa-Blinder-Oaxaca “coefficient effect.”
  • Compositional — changes in who gets treated across groups (Δπ,B,Δπ,W\Delta_{\pi,B}, \Delta_{\pi,W}). The KBO “endowment effect.”
  • Pre-treatment — changes in the baseline distribution that determine how much a fixed treatment effect translates into inequality (Δμ,Δσ\Delta_\mu, \Delta_\sigma). Has no KBO analogue — this is what the variance-decomposition framing adds.

Sequential decompositions of this kind are path-dependent: the size of Δβ\Delta_\beta depends on whether you switch β\beta before or after π\pi. ineqx() defaults to order = "shapley", which averages across all 3!=63! = 6 orderings to give an order-invariant decomposition. plot(<causal>, type = "shapley") displays the Shapley point estimate and the range across orderings.

4. A note on the variance of logs

ineqx() accepts ystat = "VL" for the descriptive case (it log-transforms yy and runs the standard variance decomposition), but the paper recommends against VLV_L for substantive decomposition work. The reason: because the log transformation is non-linear, the within- and between-group components of VLV_L can move in the opposite direction from within- and between-group changes on the income scale. A treatment that unambiguously raises within-group dispersion in dollars can register as compressing it in VLV_L. VV and CV2CV^2 do not have this pathology and decompose into components that remain interpretable on the original income scale. ineqx() issues a runtime warning whenever ystat = "VL" is used — see the FAQ for details.