Statistical Methods
Audit a Minimum-Cost One-to-One Pairing
Define the task
Define the meaning of each matrix row, column and cost before optimizing. Each row must be paired to one distinct column in the small square problem handled here. Lower cost means preferable under the declared objective, not necessarily scientifically valid or fair. Use synthetic labels and costs, never patient identifiers. If a pairing is prohibited, do not encode it as zero: zero is an allowed cost. The teaching tool requires every pairing to be allowed and supports at most seven rows.
Carry out the check
Inspect whether costs share a comparable scale and whether the objective is a sum rather than a maximum or a balance constraint. The browser tool enumerates all possible assignments and returns one minimum, using the first lexicographic solution on exact ties. This intentionally small implementation solves the same objective as a general assignment solver but is not its algorithm. Record the matrix and output mapping together. A minimal distance pairing does not by itself control confounding, establish exchangeability or satisfy additional operational constraints.
Worked hypothetical example
For a fictional cost matrix with rows (8,2,7), (6,4,3), (5,9,1), assigning columns 2,1,3 to rows 1,2,3 costs 2+6+1=9. Check all six possible assignments; their totals are 13,20,9,10,22,16. Choosing the smallest available cost greedily can fail on other matrices. Verify that each column appears exactly once and independently sum selected cells. If several assignments tie, report that the chosen mapping is not uniquely optimal.
Method checked 16 November 2026 against SciPy documentation: linear_sum_assignment.