Utilities

match_stream.simulate_matching(n=20000, *, n_r=5, n_i=4, effect=1.0, seed=20261101)[source]

Simulated units for matching.

With the defaults it reproduces tests/data/ref_data.csv, the data the test suite’s reference values were computed on.

Parameters:
  • n (int) – Units.

  • n_r (int) – Levels of the two stratum columns r and i (n_r * n_i strata).

  • n_i (int) – Levels of the two stratum columns r and i (n_r * n_i strata).

  • effect (float) – The treatment effect on y.

  • seed (int) – Random seed.

Returns:

polars.DataFrame – Columns id (1..n), r, i, d (treatment, 0/1), x1, x2, x3, ps (the true propensity score), y.