Which donors can ever matter#

A synthetic control is a weighted average of donors, with weights that are non-negative and sum to one. Before fitting one, there is a question you can answer about the donor pool alone: is any donor redundant, in the sense that some blend of the others already does everything it could do? A donor like that can never carry weight, so it can be deleted before any estimation begins, and the answer does not change.

Becker and Klossner (2018) call the donors that survive this test sunny and the ones it deletes shady. mlsynth implements the test in mlsynth.utils.solvers.sunny, and VanillaSC runs it automatically when backend="mscmt".

This page says what the test decides, what it does not decide, and the one thing an applied reader most needs to know about it: on the panel shapes synthetic control is usually run on, it deletes nothing, and that is the expected answer, not a failure.

Notation#

Write \(A\) for the treated unit’s matching vector, with one entry per matching condition – a pre-treatment period, or a predictor averaged over a window. Write \(B\) for the donor matrix, one column per donor. Let \(m\) be the number of matching conditions and \(J\) the number of donors.

Centre every donor on the treated unit,

\[x_j = B_{\cdot j} - A ,\]

so the treated unit sits at the origin and each donor is its deviation from it. A synthetic control is a convex combination of the \(x_j\), so the set of achievable fits is the convex hull

\[H = \operatorname{conv}(x_1, \ldots, x_J) ,\]

and the best synthetic control is the point of \(H\) nearest the origin.

The centring is the definition, not a convention: asking whether donors can reproduce the treated unit is asking where the origin sits relative to \(H\). Subtracting the same vector from every unit leaves each \(x_j\) unchanged, so the test is invariant to it; subtracting a different amount from each unit, as unit demeaning does, gives a different design and can give a different answer.

The test#

Walk outward from the origin along the ray toward donor \(j\). The ray passes through the points \(\alpha x_j\) as \(\alpha\) grows from zero, and reaches the donor at \(\alpha = 1\). Define

\[\alpha^*(j) = \min \{ \alpha \ge 0 : \alpha x_j \in H \} .\]

Since \(x_j\) generates \(H\), the value \(\alpha = 1\) is always feasible, so \(\alpha^*(j) \le 1\) and the test is one-sided by construction. Donor \(j\) is sunny when \(\alpha^*(j) = 1\) and shady when \(\alpha^*(j) < 1\).

A picture makes the name. Put a lamp at the treated unit and treat \(H\) as opaque. Light travels outward and stops at the first surface it meets. If the ray reaches \(x_j\) before entering the solid, the donor is the first thing the light touches in that direction and it is lit. If the ray enters the solid first, the donor sits behind that surface, in shadow.

The economics of the shadow case is the part to hold on to. If the ray enters \(H\) at some \(\alpha^* < 1\), the entry point is itself a blend of donors. So there is a weighted average of the others lying directly between the treated unit and donor \(j\), and closer to the treated unit than \(j\) is. That blend does whatever \(j\) does, in the same direction, only nearer the target. Donor \(j\) is redundant.

A one-variable example#

Match on a single variable, pre-treatment GDP per capita. The treated unit sits at 10, donor A at 12, donor B at 20. Centred, \(x_A = 2\) and \(x_B = 10\), so \(H\) is the segment \([2, 10]\) on the line.

Standing at the origin and looking along the line, the segment begins at 2. The light stops there, so A is lit and B is in shadow: A stands between the observer and B. The estimator agrees. Both donors overshoot the target in the same direction, convex weights cannot go below the nearest donor, and the best achievable fit puts all the weight on A. B takes zero weight, and it does so for any choice of predictor weighting, since in one dimension a positive weight cannot reorder \(2 < 10\).

In higher dimensions the picture is the same with a polygon in place of a segment: the faces turned toward the lamp are lit, the ones around the back are hidden, and anything strictly inside is dark.

What the test guarantees#

Two results give the screen its use. Both are pinned in mlsynth/tests/test_sunny_donors.py.

Proposition 1#

No donor is sunny exactly when the origin lies in \(H\), which is exactly when the donors can reproduce the treated unit’s matching vector exactly.

So an all-shady verdict does not mean the donor pool is worthless. It means the opposite: a perfect pre-treatment fit exists. Every weight vector attaining it ties on the matching objective, so a search over predictor weights is choosing among exact ties on numerical accident, and Becker and Klossner’s Eq (10) states the intended rule instead – among the perfect-fit weights, take the one with the best outcome fit. VanillaSC with backend="mscmt" takes that branch when it arises.

Proposition 2#

Provided at least one donor is sunny, a shady donor takes zero weight at every optimum, for every predictor weighting \(V\).

The quantifier over \(V\) is what makes the screen usable before estimation. A test that held only at the weighting the search eventually selects would require finishing the search to know what to delete. Holding for every \(V\) means the deletion is safe to make first.

The proviso is not slack. A donor whose centred column is the origin reproduces the treated unit on its own; it is shady with \(\alpha^* = 0\), and deleting it would discard an exact fit. Proposition 1 is what rules that out, which is why sunny_support() checks for a sunny donor before it prunes anything.

What sunny does not mean#

The guarantee runs one way. Shady implies zero weight; sunny does not imply positive weight. Sunny means the screen failed to rule the donor out, which is weaker than a claim that some weighting would use it.

Abadie and Gardeazabal’s Basque study makes the distinction concrete. Baleares receives zero weight in the fitted synthetic Basque Country, and looks like the kind of donor a screen ought to delete. It is emphatically sunny. No combination of the other fifteen regions reproduces its path: leaving it out and fitting it from the rest leaves a residual of 0.97 in relative terms. Baleares is the richest region in the pool, an extreme point, and it takes zero weight because the objective has no use for its direction at the selected weighting – not because anything else can stand in for it.

Redundant and unwanted are different properties, and only the first is what the screen detects. The second is a statement about one weighting, and it is available cheaply from the fitted solution: at an optimum with residual \(u^* = B w^* - A\), donor \(j\) holds zero weight at every optimum of that particular program exactly when \(\langle x_j, u^* \rangle > \lVert u^* \rVert^2\). That is a diagnostic to report at a fitted \(V\), never a filter to prune with: of 245 donors it excluded at one weighting, 111 carried weight at another.

When the screen finds anything#

This is the practical question, and the answer is narrow.

Shadiness needs more donors than matching conditions, and by a comfortable margin. Holding \(J = 30\) and varying \(m\) over 40 Gaussian designs per row:

\(m\)

\(J/m\)

exact fit

prunes something

median donors pruned

2

15.0

31

9

27

3

10.0

23

17

25

5

6.0

8

32

14

6

5.0

3

37

10

8

3.8

0

37

2

10

3.0

0

12

1

14 and above

2.1 and below

0

0

–

Shadiness is squeezed from both ends. Above \(J/m\) of about 10 the origin falls inside the hull often enough that the screen is answering Proposition 1 and reporting an exact fit. Below about 3 there is nothing to prune. Between them, at \(J/m\) roughly 4 to 10, shady donors are abundant.

Applied panels sit below that band. On the Basque design every donor is sunny: 16 of 16 on the outcome-only specification with 20 pre-periods, and 16 of 16 in the 13-predictor space where the backend runs the screen, matching the R package MSCMT’s own console line. Shady donors appear on that panel only when the matching window is cut to 5 pre-periods (12 of 16 sunny), 3 (5 of 16) or 2 (2 of 16) – designs nobody would estimate on. Across the four simulation designs this library benchmarks, only Xu’s produces shady donors at all, at 0 to 2.4 percent of the pool.

So on a conventional application the screen deletes nothing, and the value it delivers is Proposition 1’s case detection. That is the expected outcome, not a shortfall.

The case where the answer is free#

When the centred columns are linearly independent the screen cannot find anything, and a rank computation says so without solving anything.

If \(\operatorname{rank}(X_t) = J\), then \(\alpha x_j = X_t \lambda\) with \(\sum \lambda = 1\) rearranges to \(X_t (\lambda - \alpha e_j) = 0\), forcing \(\lambda = \alpha e_j\) and so \(\alpha = 1\). Every donor is sunny by algebra. sunny_screen_is_vacuous() reports this, and the screen short-circuits on it.

The distinction it draws matters to a reader of the output. An all-sunny verdict on a design where the gate fires says nothing about the donor pool – it is a fact about the design’s shape. An all-sunny verdict where the gate does not fire says the pool really is irreducible. The counts alone cannot tell those apart, which is why the flag is reported alongside them. On the four benchmarked simulation designs, 35 of 47 cells are settled by the gate before any linear program runs.

Example#

import numpy as np
import pandas as pd
from mlsynth.utils.solvers.sunny import (
    sunny_alphas, sunny_donors, sunny_screen_is_vacuous,
)

url = ("https://raw.githubusercontent.com/jgreathouse9/mlsynth/"
       "main/basedata/basque_mscmt.csv")
df = pd.read_csv(url)
treated, aggregate = "Basque Country (Pais Vasco)", "Spain (Espana)"

panel = df.pivot(index="year", columns="regionname", values="gdpcap")
donors = [c for c in panel.columns if c not in (treated, aggregate)]

def design(years):
    A = panel.loc[years, treated].to_numpy(float)
    B = np.column_stack([panel.loc[years, d].to_numpy(float) for d in donors])
    return B, A

# The design Abadie and Gardeazabal estimate on: 20 pre-treatment periods
# against 16 donors. The columns are independent, so the gate settles it.
B, A = design([y for y in panel.index if y < 1975])
print(sunny_screen_is_vacuous(B, A))            # True
print(int(sunny_donors(B, A).sum()), "of", len(donors))   # 16 of 16

# Cut the matching window to three periods and the pool becomes reducible.
B, A = design([1972, 1973, 1974])
print(sunny_screen_is_vacuous(B, A))            # False
print(int(sunny_donors(B, A).sum()), "of", len(donors))   # 5 of 16

# alpha* is the underlying quantity; 1 is sunny, below 1 is shady.
print(np.round(sunny_alphas(B, A), 3))

Cost#

The definition costs one linear program per donor. Two shortcuts apply, both exact.

The rank gate above answers the whole question with one decomposition when it fires. And when the design has been reduced to its column space – which preserves every inner product and leaves the origin in place, so the classification is identical – a small enough row count lets the sunny set be read off a single convex hull instead. The threshold is measured: at six reduced rows the hull route wins by 21 times or better at every donor count up to 500, while at eight it runs about three times slower than the programs once there are 100 donors or more, because a hull of \(n\) points in dimension \(d\) carries up to about \(n^{\lfloor d/2 \rfloor}\) facets.

Verification#

The screen’s own tests are mlsynth/tests/test_sunny_donors.py, test_sunny_column_space.py and test_sunny_hull_route.py. The predicate was checked against the variational form of \(\alpha^*\) to 6e-13 over 884 donors, and against the exposed-face characterisation over 84 designs with no donor classified differently. The MSCMT backend that consumes it is cross-validated against the R package in mscmt_basque.

References#

Becker, M. and Klossner, S. (2018). Fast and reliable computation of generalized synthetic controls. Econometrics and Statistics, 5, 1-19.

Abadie, A. and Gardeazabal, J. (2003). The economic costs of conflict: a case study of the Basque Country. American Economic Review, 93(1), 113-132.

Core API#

Becker and Klossner’s sunny/shady donor screen for simplex programs.

Write x_j = B[:, j] - A for the centred donor columns and H = conv(x_1, ..., x_J). The screen asks one question per donor:

alpha*(j) = min { alpha >= 0 : alpha x_j in H }

Donor j is sunny when alpha*(j) = 1 and shady when alpha*(j) < 1, i.e. when some shorter multiple of its own column already lies in the hull. Since x_j is one of the generators of H, alpha = 1 is always feasible, so alpha* <= 1 and the test is one-sided by construction.

Two facts give the screen its use, and both are pinned in mlsynth/tests/test_sunny_donors.py:

Proposition 1. No donor is sunny exactly when 0 in H, which is exactly when min ||A - B w|| over the simplex is zero. So a screen that returns all-shady has found an exact fit, not a set of columns to drop.

Proposition 2. If no exact fit exists, every optimum puts zero weight on every shady donor. At an optimum u* = B w* - A the simplex stationarity conditions give <x_k, u*> = min_i <x_i, u*> = ||u*||^2 for each k in the support, and the feasible move w* - t e_j + t lambda built from alpha x_j = sum_i lambda_i x_i sends u* to u* - t (1 - alpha) x_j. Together these force alpha ||u*||^2 >= ||u*||^2, so alpha < 1 implies u* = 0. The conclusion holds at every optimum, so the columns may be dropped even when the argmin is a face.

The hypothesis on Proposition 2 is not slack that can be ignored. A donor with x_j = 0 reproduces the treated path on its own and is shady with alpha*(j) = 0; dropping it would discard an exact fit. Proposition 1 is what rules this out: when at least one donor is sunny there is no exact fit, and only then is pruning licensed. sunny_support encodes that branch.

alpha* costs one linear program per donor. certified_sunny decides a subset of them from a single Gram matrix instead. For any direction c, alpha x_j = sum_i lambda_i x_i gives alpha c'x_j = sum_i lambda_i c'x_i >= min_i c'x_i, so whenever c'x_j > 0

alpha*(j) >= (min_i c’x_i) / (c’x_j),

and a bound reaching 1 certifies donor j sunny. Sweeping c over the donor columns themselves reads every such bound off G = Xt' Xt: row i supplies min_k G[i, k] / G[i, j] for each j with G[i, j] > 0. The direction that certifies a donor is usually not its own column, so the c = x_j term alone leaves most of the power unused – on 40x8 Gaussian designs the own-column test certifies nothing at all while the full sweep certifies 40 percent of donors.

Where the screen pays, the certificate helps least. Over 200 Gaussian designs, 40 per regime, it certifies 40 percent of donors at 40x8, 29 percent at 12x12, 10 percent at 8x40 and 2 percent at 5x74 – and the first two regimes have every donor sunny, so there is nothing there to prune. At 5x74, where only 10 percent of donors are sunny and pruning pays, skipping the certified donors cuts 2 percent off the runtime. The certificate is sound and near free, not a replacement for the linear program.

One family of designs admits no shady donor at all, and the screen detects it for the price of one rank. If Xt has trivial kernel then alpha x_j = Xt lambda rearranges to Xt (lambda - alpha e_j) = 0, forcing lambda = alpha e_j and so sum lambda = alpha = 1: every donor is sunny by algebra. Linear independence of the centred columns is equivalent to their being affinely independent with 0 outside their affine hull, so this is exactly the case Proposition 1 leaves no room in. sunny_screen_is_vacuous reports it and the gate skips all J linear programs.

The case is the ordinary one for outcome-only panels with a long pre-period. On Abadie and Gardeazabal’s Basque design with treatment in 1975 and gdpcap alone, 20 pre-periods against 16 donors give rank(Xt) = 16, and every donor comes back at alpha* = 1 exactly. Shortening the window does not help much: 16 of 16 are still sunny at 10 and at 7 pre-periods, and in the 13-predictor space where MSCMT runs the screen the columns are affinely dependent yet all 16 remain sunny. Shady donors appear only at 5 pre-periods (12 of 16 sunny), 3 (5 of 16) and 2 (2 of 16). The concept bites when J greatly exceeds m, not merely when it exceeds it.

alpha* is the radial function of H read from outside. Hug and Weil (Lectures on Convex Geometry, Exercise 2.3.3) define rho(K, x) = max{lam >= 0 : lam x in K} for 0 in the interior of K, the far intersection of the ray with the body, and give rho = h(K-polar, .)^-1. Here 0 lies outside H and the near intersection is wanted, so the same ray construction runs on the other side of the origin. Writing H through its support function, alpha x_j in H holds exactly when alpha <c, x_j> <= h(H, c) for every c; splitting on the sign of <c, x_j> and using -h(H, -c) = min_i <c, x_i> gives

alpha*(j) = sup over c with <c, x_j> > 0 of min_i <c, x_i> / <c, x_j>,

the supremum being attained because normalising <c, x_j> = 1 makes it a linear program, feasible for x_j nonzero and bounded by t <= 1. Checked against Eq (9) to 6e-13 over 884 donors on designs with 0 outside H; where 0 is inside, Eq (9) clamps alpha >= 0 while the formula runs negative, and the two still agree on the sunny predicate.

Three things follow. The certificate above is this supremum evaluated at the J directions c = x_i, a finite sample of a supremum over the sphere, which is why it is weak and why no cheaper sound certificate is available: the exact predicate is the supremum, and taking a supremum over directions is a linear program. Second, sunny is equivalent to the existence of a single c with <c, x_j> > 0 and <c, x_j> = min_i <c, x_i> – a hyperplane supporting H at x_j that separates the origin – so a program solving for that c and Eq (9), which solves for alpha, are the two sides of one linear program. MSCMT carried such a hyperplane program until it was consolidated onto this module; it survives as tests/test_sunny_mask_consolidation.py::_hyperplane_reference, which cross-checks the two sides on the designs where they could disagree. Third, the transposed shape buys no speed: timed across five designs the support-side program runs at 0.84 to 0.98 times Eq (9), so the formulation explains the code here without replacing it.

In the vocabulary of convex geometry the predicate has a short form. Balestro, Martini and Teixeira give h_P(u) = max_j <x_j, u> for a polytope generated by the x_j (Lemma 2.3.4), x in K exactly when <x, u> <= h_K(u) for every u (Corollary 2.3.1), and F(K, u) = {x in K : <x, u> = h_K(u)} as the face exposed by u (Exercise 2.36); Hug and Weil carry the same two identities as Theorem 2.7(b) and 2.7(g). Together with the supremum formula above,

x_j is sunny <=> x_j lies on an exposed face F(H, u) with h_H(u) < 0,

since h_H(u) < 0 puts the origin strictly outside that face’s supporting halfspace. Tested as a linear program against Eq (9) over 84 designs, no donor classified differently. This is also why sunny does not mean vertex: a sunny donor may sit in the relative interior of a higher-dimensional exposed face, as x_1 = (1, 0) does among (1, 2) and (1, -2) in the tests here.

The predicate does have a classical form, in polytope shelling theory. Gruber (Convex and Discrete Geometry, Theorem 15.4, the Bruggesser-Mani shelling theorem) orders the facets of a polytope by when they become visible from an external point, “the facets visible from p come first”, and a facet with outward normal u is visible from the origin exactly when h_H(u) < 0, the condition above. On a full-dimensional hull the two agree: over 32 designs with dim H = m, sunny and “lies on a facet visible from the origin” classified every donor alike. The exposed-face form is the one to state in general, because dim H <= min(m, J-1) leaves H without ambient facets on most panels here, and the visible-facet form is its full-dimensional special case. So the sunny set is the part of the hull’s boundary visible from the treated unit, a notion the literature uses to build shellings.

The quantity alpha* itself is still not named in any of these references, and four candidate classical objects each miss it. The radial function rho(K, x) = max{lam >= 0 : lam x in K} (Hug and Weil Exercise 2.3.3; Balestro et al. Section 2.3) requires the origin in the interior of K and takes the far intersection of the ray. The Minkowski gauge p_C(x) = inf{lam >= 0 : x in lam C} (Correa, Hantoute and Lopez (2.25)) needs no interior origin but scales the set instead of the point and takes an infimum: measured on a donor with alpha* = 0.530 its reciprocal reads 1.000, so it does not see shadiness. The support cone cl{lam (z - x) : z in K, lam > 0} (Balestro et al., Section 2.4) has its apex at a point of the body, not outside it. Gruber’s radial function is a norm ||x||_C = inf{lam > 0 : x in lam C} for C centred at the origin, and his radial mapping assumes the origin interior; he has no gauge function. Illumination appears only as Hadwiger and Boltyanski’s covering problem for parallel light, and in Gruber only as Blaschke’s ellipsoid characterisation through shadow boundaries under parallel illumination (Theorem 12.4); it is absent from Hug and Weil. The phrase “central illumination”, which names this configuration, occurs twice in Balestro et al. without a definition, and nowhere in Gruber. Blekherman, Parrilo and Thomas is a different subject (spectrahedra and polynomial cones) and carries none of it.

One consequence for the proof. The equivalence cannot be had by separating H from the half-open segment {alpha x_j : 0 <= alpha < 1}: that segment is not compact, so Hug and Weil’s Remark 1.18 gives no strong separation and Theorem 1.17 gives only proper separation, which leaves the supporting value at zero and the argument stuck. Attainment in the linear program above is what closes it.

Reference: Becker and Klossner (2018), Fast and reliable computation of generalized synthetic controls, Econometrics and Statistics 5, 1-19, Section 3.1 and Definition 1; isSunny in MSCMT’s R/Helpers.r and the donor loop in R/multiOpt.r. Convex geometry as cited above: Hug and Weil, Lectures on Convex Geometry (GTM 286); Balestro, Martini and Teixeira, Convexity from the Geometric Point of View; Correa, Hantoute and Lopez, Fundamentals of Convex Analysis and Optimization.

mlsynth.utils.solvers.sunny.certified_sunny(B: ndarray, A: ndarray) → ndarray

Flag the donors that a single Gram matrix proves sunny.

Row i of G = Xt' Xt carries the bound from direction c = x_i, namely min_k G[i, k] / G[i, j] for every j whose inner product with x_i is positive; donor j is certified when the best bound over all rows reaches 1. The flags are a subset of the sunny donors – a donor left unflagged has not been shown to be shady and still needs its linear program.

mlsynth.utils.solvers.sunny.sunny_alphas(B: ndarray, A: ndarray) → ndarray

Return alpha*(j) for every donor, one linear program each.

This is the reference: it consults no certificate, so it is what the cheap tests are measured against.

mlsynth.utils.solvers.sunny.sunny_donors(B: ndarray, A: ndarray, *, tol: float = 1e-07, certify: bool = True) → ndarray

Classify every donor as sunny (True) or shady (False).

With certify the Gram test above settles what it can and a linear program is solved only for the rest; the answer is the same either way, since the certificate proves sunniness and never asserts shadiness.

mlsynth.utils.solvers.sunny.sunny_screen_is_vacuous(B: ndarray, A: ndarray) → bool

Report whether no donor on this design can be shady.

True when the centred columns are linearly independent, which forces alpha*(j) = 1 for every donor. A caller that sees True learns that the screen has nothing to say here and can skip it: there is no pruning to be had, whatever the treated path looks like.

mlsynth.utils.solvers.sunny.sunny_support(B: ndarray, A: ndarray, *, tol: float = 1e-07, certify: bool = True) → ndarray

Return the donor indices a simplex solve can be restricted to.

When some donor is sunny these are the sunny ones: by Proposition 2 the shady columns take zero weight at every optimum, so the restricted program has the same value and the same reachable fits. When no donor is sunny an exact fit exists, Proposition 2 does not apply, and every index is returned – the shady columns are the ones that reach the fit.