MAREX — Abadie & Zhao (2026) Walmart design (live R cross-validation)#

Live, commit-stamped cross-validation of MAREX – mlsynth’s port of Abadie & Zhao’s synthetic-control experimental-design estimator – against the authors’ own R code on the paper’s Section 4 Walmart application. The reference is jinglongzhao2/SCDesign, run live (no commercial solver) and captured under benchmarks/reference/marex_walmart/.

This complements LEXSCM — Synthetic Experimental Design (Abadie-Zhao 2026; Vives-i-Bastida 2022), which validates the same Abadie-Zhao design on the same Walmart panel through the lexicographic LEXSCM solver; here the check runs MAREX’s own mixed-integer optimizer.

Validated without Gurobi#

SCDesign’s published design is a Gurobi non-convex MIQP, which is licence-gated. Its constrained (cardinality-\(K\)) routine, however, is fully open: Synthetic_Experiment_Cardinality_Constraint enumerates every partition of size \(\le K\), solves each treated/control synthetic control through quadprog::solve.QP, and keeps the min-loss partition. That is exactly the design MAREX’s m_eq solves, and it runs with no commercial solver. The reference script (benchmarks/reference/marex_walmart/reference.R) reproduces it verbatim, together with the authors’ permutation test and conformal interval, on the full 45-store panel.

Data#

basedata/walmart_weekly_sales_covariates.csv – the full SCDesign Walmart panel (45 stores x 143 weeks; sales value-identical to Walmart.csv) with the four store-level covariates (temperature, fuel price, CPI, unemployment). The design matches on the pre-period sales and these covariates – the R code’s “few covariates” configuration. Windows follow the paper: fit weeks 1-100, blank 101-128, experimental 129-143 (T0 = 128, blank_periods = 28, T_post = 15), m_eq = 2, uniform population weights, per-predictor standardisation.

Result — placebo design (Sec. 4)#

A placebo intervention (week 129, no real effect) must yield a design whose synthetic treated and control units track closely pre-period and whose estimated effect is indistinguishable from zero. MAREX and SCDesign agree cell-by-cell:

Quantity

MAREX

SCDesign (quadprog)

Treated stores selected

15, 31

15, 31

Treated weights

0.461 / 0.539

0.461 / 0.539

Pre-fit RMSE (% mean sales)

2.90%

2.84%

Placebo effect (% mean)

2.73%

2.74%

Placebo permutation p

0.125

0.109

CI covers zero

yes

yes

The two implementations select the same two treated stores. SCDesign rounds every weight to four decimals, and MAREX’s 45 treated and control weights rounded the same way equal SCDesign’s; the placebo effect computed from MAREX’s rounded weights equals the reference to every printed digit, so the remaining gap in the effect, \(2.3\times10^{-4}\) of mean sales, is SCDesign’s rounding. This is the paper’s “no spurious effect” result, reproduced across languages and solvers without Gurobi. Both sides average the time-varying covariates over the fitting weeks only; before issue #759 MAREX also averaged them over the blank weeks, and its weights then differed from SCDesign’s by up to \(7.9\times10^{-4}\). (The permutation p differs by about 0.02 because the two Monte-Carlo permutation samples differ; both fail to reject. Abadie & Zhao’s headline \(p = 0.933\) is the no-covariate special case – matching on the covariates tightens the design and lowers the placebo p, as in the authors’ own covariate runs.)

Note

Exact MIQP, not the relaxation. MAREX uses its exact MIQP (free SCIP backend). The relaxed continuous-z mode shares A&Z’s objective (build_objective is common to both) but drops the integrality that defines the selection; for a small treated count the relaxed optimum is degenerate, so its top-m rounding is lossy and non-deterministic – unfaithful to the paper’s exact design.

Reproduce#

# regenerate the captured SCDesign reference (needs R + quadprog + Matrix)
python benchmarks/reference/generate.py marex_walmart
# run the cross-validation
python benchmarks/run_benchmarks.py marex_walmart

Path B — the Section 5 simulation (Table 2)#

The Walmart check above is Path A on the authors’ empirical application. Their Section 5 simulation is a separate target, and it is the one that exercises the cardinality constraint across its range and the design family beyond standard.

Panels are read, not regenerated. benchmarks/reference/marex_scdesign_sim/ captures a live run of the authors’ own Generate_Model_Primitives (“2. Many Simulations (…)/Main_LazyRun.R”), under the seeding their driver uses: R_job.qsub submits an SGE array job (#$ -t 1-1000) and the script reads repetition.RANDOM.SEED = Sys.getenv("SGE_TASK_ID"), so simulation \(i\) is set.seed(i) — a thousand independent streams, not one advancing stream. The next section regenerates all 1000 of these panels in Python, checked against this capture.

Under that convention their DGP reproduces Table 2’s effect path exactly:

\(t=26\)

\(t=27\)

\(t=28\)

\(t=29\)

\(t=30\)

paper, Table 2

-13.58

-10.99

-8.35

-5.00

-2.50

their code, their seeds

-13.5763

-10.9889

-8.3521

-4.9981

-2.4999

The largest gap is 0.004, which is the table’s own display rounding. No design is solved to produce this, so it isolates the data-generating process.

Estimates use the paper’s equation (8), \(\hat\tau_t = \mathbf{w}'\mathbf{Y}_{I,t} - \mathbf{v}'\mathbf{Y}_{N,t}\), scored against the realized \(\tau_t\) under uniform population weights. On 12 captured panels against the paper’s 1000 simulations:

design

MAE

paper

RMSE

paper

\(\|w\|_0\)

Constrained \(m = 1\)

3.03

2.93

3.49

3.45

1.0

Constrained \(m = 3\)

1.23

1.26

1.41

1.49

3.0

Unconstrained

0.57

0.83

0.69

0.97

6.83 (paper 6.76)

The paper’s headline for Table 2 reproduces: accuracy improves monotonically as the cardinality constraint relaxes, and the unconstrained design selects about seven of the fifteen units without being told to. The unconstrained cell runs better than the paper’s at this panel count, which is the Monte-Carlo error of 12 draws against 1000 and is what the tolerances absorb.

The weakly targeted design#

Formulation (9) matches the treated synthetic to the population predictor vector and ties the control synthetic to it with weight \(\beta\), so \(\beta\) trades between estimating \(\tau_t\) and the effect on the treated, \(\tau^T_t\). The paper reports that a large \(\beta\) gives high relative accuracy for the latter.

The measurement does not settle it. Root mean square error against \(\tau^T_t\) at \(m = 3\) is 1.46 for design="standard" against 1.66 for design="weakly_targeted" with \(\beta = 20\) on these 12 panels — standard ahead. On 20 panels drawn from an independent stream the order was reversed, and at 25 the weakly targeted design led by about 0.9 combined standard errors. The ordering sits inside the noise at any panel count a benchmark can afford, so the case pins the two levels and does not assert it. The levels still catch a regression in either design, and this is the only coverage weakly_targeted has outside unit tests.

Durable case#

benchmarks/cases/marex_section5_mc.py

python benchmarks/run_benchmarks.py --case marex_section5_mc

Fourteen pinned quantities. Runtime is about 180 seconds, almost all of it the mixed-integer solves.

Path B — bias of the base design#

Table 2 reports mean absolute and root mean square errors. Whether the estimator is unbiased, whether its error averages to zero, needs the signed error over many simulations: its standard error is about 0.4 on 12 panels at \(m = 3\) and 0.024 on 1000.

The authors’ 1000 panels#

generate_section5_sample() ports R’s set.seed, its Mersenne-Twister generator and its inversion rnorm, and replays Generate_Model_Primitives draw by draw. generate_section5_sample(i) is the authors’ simulation \(i\). Against the R capture above it reproduces every outcome and covariate of the 12 captured panels to \(5.0 \times 10^{-11}\), the capture’s ten printed decimals, and the 1000-seed effect path to \(3.2 \times 10^{-7}\), its six. The full simulation therefore runs without R.

The bias a design carries#

In this DGP the intercepts \(\delta_t\) and \(\upsilon_t\) are sorted over time, and every coefficient vector, \(\theta_t\), \(\gamma_t\), \(\lambda_t\) and \(\eta_t\), is drawn afresh each period on Uniform(0, 10). The weights \(\mathbf{w}\), \(\mathbf{v}\) and \(\mathbf{f}\) each sum to one, so the intercepts cancel from \(\hat\tau_t - \tau_t\), and the design reads only the fitting periods, which are independent of the post-period coefficients and noise. Given the design,

\[\mathbb{E}\left[\hat\tau_t - \tau_t \mid \mathbf{w}, \mathbf{v}\right] = 5\,(\mathbf{w} - \mathbf{v})^\top \mathbf{s}, \qquad s_j = \sum_{k=1}^{7} Z_{kj} + \sum_{f=1}^{11} \mu_{fj},\]

with 5 the coefficients’ mean. The bias is the same in every post period, and it is zero when the treated and control blends match on every covariate, observed or not. The simulator returns the unobserved \(\boldsymbol{\mu}\), so the bias of every design is computed exactly.

Averaged over the DGP it is zero. Replacing each covariate by one minus itself and each noise term by its negative leaves the DGP’s distribution unchanged, and maps \(Y_{N,jt}\) to \(a_t - Y_{N,jt}\) with \(a_t\) common to all units. MAREX’s design is unchanged by that map, so the same \((\mathbf{w}, \mathbf{v})\) is chosen and the bias changes sign, since \((\mathbf{w} - \mathbf{v})^\top \mathbf{1} = 0\). On 20 panels at each cardinality the case checks this directly: the weights move by at most \(6.3 \times 10^{-15}\) and the two biases cancel to \(2.5 \times 10^{-14}\).

Results#

The paper’s 1000 simulations, MAREX’s standard design on the exact backend, scored as in Table 2. Mean signed error is pooled over the five post periods; the design’s bias is \(5\,(\mathbf{w} - \mathbf{v})^\top \mathbf{s}\); standard errors are in parentheses.

\(m = 1\)

\(m = 3\)

unconstrained

MAE (paper)

2.878 (2.93)

1.219 (1.26)

0.731 (0.83)

RMSE (paper)

3.409 (3.45)

1.457 (1.49)

0.868 (0.97)

treated units (paper)

1

3

6.76 (6.76)

mean signed error

-0.018 (0.064)

+0.008 (0.024)

+0.014 (0.015)

largest per-period t

1.20

1.73

1.68

mean of the design’s bias

-0.023 (0.044)

+0.014 (0.013)

+0.010 (0.009)

RMS of the design’s bias

1.39

0.41

0.27

its share of the MSE

15%

7%

8%

blank-period gap on the bias: slope

0.97

0.98

1.05

The base design is unbiased on the paper’s simulation. The mean signed error is within one standard error of zero at every cardinality, as is the mean of each design’s bias, and no post period’s mean error is two standard errors from zero.

Unbiased on average is not unbiased in a given experiment. A single design carries a bias whose root mean square is 1.39 at \(m = 1\), 0.41 at \(m = 3\) and 0.27 unconstrained, 7-15% of the mean square error. It falls as the design gets more units to blend, which is Abadie and Zhao’s remark that the better the pre-experiment match, the smaller the bias.

The blank periods measure that bias. Their coefficients have the same mean as the post periods’, so the mean blank-period gap \(\mathbf{w}^\top\mathbf{Y}_{N,t} - \mathbf{v}^\top\mathbf{Y}_{N,t}\), which MAREX reports as post_fit.power.placebo_bias, estimates the design’s bias: regressed on it across the 1000 designs, the slope is 0.97 to 1.05. Five blank periods make it a noisy estimate, with correlations of 0.47 to 0.65.

At the paper’s own 1000 panels, Table 2 reproduces to within 0.05 for the constrained designs and 0.1 unconstrained, where the design selects 6.76 units on average, the paper’s figure. The panels are the same, so the remaining differences are in the design: the authors’ routines, the one captured above among them, standardize the predictors and include the seven observed covariates, and this design matches the pre-period outcomes alone.

Durable case#

benchmarks/cases/marex_section5_bias.py

python benchmarks/run_benchmarks.py --case marex_section5_bias
# the unconstrained column, about 15 minutes
python -m benchmarks.cases.marex_section5_bias unconstrained

Twenty pinned quantities on \(m = 1\) and \(m = 3\), in about 15 seconds: the simulator against R, Table 2’s cells, the bias t statistics, the design bias, the blank-period slope and the reflection.

Cross-validation against SCDesign on the same panels#

Table 2 compares averages. This compares designs: the authors’ own R routine and MAREX solve the same program on the same panel, checked unit by unit and weight by weight.

The same captured bundle carries, for each panel, the design SCDesign’s Synthetic_Experiment_Cardinality_Constraint selected. That routine is exact by construction — it enumerates every partition of size \(1 \le p \le K\), solves the treated and control weights for each by quadprog::solve.QP, and keeps the minimum — so its answer is the optimum, and MAREX’s mixed-integer solve has to reach it. It needs no commercial solver; SCDesign’s headline design is a Gurobi MIQP and is not used. It is the design MAREX solves with m_min = 1, m_max = K.

Matching is on the 20 fitting periods and the 7 observed covariates with per-predictor standardisation, which is the routine’s row rescaling.

Across 12 panels at \(K = 2\) the two select the same treated units every time and agree on the treated weights to 7.0e-05 — the two solvers’ numerical tolerance, R working on a nearPD-repaired Hessian and rounding to six decimals.

benchmarks/cases/marex_scdesign_sim.py

# refresh the captured SCDesign run (needs R + quadprog + Matrix)
python benchmarks/reference/generate.py marex_scdesign_sim
# run the cross-validation (no R needed; reads the committed bundle)
python benchmarks/run_benchmarks.py --case marex_scdesign_sim

The exact backend against brute force#

The checks above run MAREX’s mixed-integer solve. Its exact backend (backend="exact") reaches the design by a different route: it prices every treated set with a closed-form lower bound on the treated fit, fits only the sets whose bound is under the best design found so far, stops each weakly-targeted fit as soon as a certified lower bound clears that design, and fits with an active-set solver. Each of those steps could lose the optimum without any comparison with a port of the same search noticing, since a port would share them.

The reference shares none of them. benchmarks/reference/marex_exact_bruteforce/reference.R enumerates every treated set of the stated size and solves each fixed-set program with quadprog::solve.QP: two simplex fits for the separable designs, one joint quadratic program over both weight vectors for the weakly-targeted design. Its answer is the optimum by enumeration. The panels are drawn in R and printed in full, so both sides score the same numbers.

Twelve configurations run on six panels of eight markets: the standard design with two and three treated, the penalized and unit-penalized designs, the weakly-targeted design at \(\beta\) = 0.01, 1 and 100, Abadie and L’Hour’s control penalty at 0.1 and at 0.6 (near its convexity bound at \(\beta = 1\)), and standardised covariates at one weight, at per-covariate weights, and with the penalised weakly-targeted design.

In all 72 cells the two select the same treated markets. The objectives agree to \(2.2\times10^{-14}\) relative, the treated weights to \(1.1\times10^{-9}\) and the control weights to \(2.1\times10^{-8}\), which is the R side’s ridge and quadprog’s accuracy. The case has power: with the search’s bound inflated fifty-fold, so that it discards sets it should fit, treated-set agreement fell to 0.72.

benchmarks/cases/marex_exact_bruteforce.py

# refresh the captured R run (needs R + quadprog)
python benchmarks/reference/generate.py marex_exact_bruteforce
# run the cross-validation (no R needed; reads the committed bundle)
python benchmarks/run_benchmarks.py --case marex_exact_bruteforce

Path B — Table 3, against the randomized alternatives#

Table 3 sets the design against five randomized alternatives at every cardinality: randomized assignment with difference in means (RND), stratified randomization (STR), regression adjustment on the covariates (REG), and nearest-neighbour matching at one and five neighbours.

The SC column is computed here, not copied. Table 3’s note defines SC as the Constrained formulation, which in Main_LazyRun.R is Synthetic_Experiment_Cardinality_Constraint — the quadprog routine, with no Gurobi call anywhere in that section — and the cross-validation above shows MAREX reaches the same design as that routine, unit for unit. The comparator columns are quoted from the table: they are properties of the authors’ randomized designs, not of mlsynth, so re-implementing them would test a transcription. What the library has to clear is the ordering they establish.

On the authors’ panels, MAREX against the strongest published alternative at each cardinality:

\(m\)

MAREX SC

paper SC

best alternative

1

3.46

3.45

4.40 (5-NN)

2

1.68

2.00

3.20 (5-NN)

3

1.30

1.49

2.66 (5-NN)

4

1.03

1.25

2.40 (5-NN)

5

0.83

1.09

2.07 (STR)

6

0.84

1.02

1.95 (STR)

7

0.82

0.97

1.85 (STR)

The paper’s headline holds at every cardinality, and by a wide margin: the design’s error is between a half and a quarter of the best randomized alternative. Clearing the strongest of the five clears the whole row.

Monotonicity is pinned only where twelve panels can resolve it. The published column falls steeply at first — 3.45, 2.00, 1.49 — then by 0.07 and 0.05 between \(m = 5, 6, 7\). Those last gaps sit inside the Monte-Carlo error of twelve panels against a thousand, and this run duly puts \(m = 6\) (0.843) a hair above \(m = 5\) (0.832). The case pins the steep range and separately pins that \(m = 7\) lands below half of \(m = 1\); asserting the full ordering would be asserting noise.

benchmarks/cases/marex_table3.py

python benchmarks/run_benchmarks.py --case marex_table3