Statistics¶
Everything here is implemented in src/abmfact/stats.py and src/abmfact/audit.py.
Intervals¶
alpha (default 0.05) is used one-sided, so every interval is a two-sided 1 - 2*alpha interval
(90% by default) and each side is a one-sided test at alpha.
Means: Student t-interval over seeds.
Differences between conditions: Welch interval for
mean(variant) - mean(baseline).Monotone claims: ordinary least squares slope of the metric on the parameter, over every run at every grid point, with a t-interval.
Claim status in one condition¶
holds, fails or uncertain, as described in claims.md.
Comparing a variant with the baseline¶
At every parameter point:
Mean, three outcomes. With tolerance
tol:equivalentwhen the difference interval lies inside(-tol, tol),shiftedwhen it lies wholly outside, otherwiseundetermined. This is two one-sided tests for equivalence, extended so that a confident difference is reported as such.Spread. Brown-Forsythe test, with the ratios of standard deviations and of interquartile ranges. Spread counts as shifted only when
p < alpha / 10and both ratios are beyond 2 in the same direction. Spread is secondary evidence, so the bar is high. It is not compared in thepopulation_scalecheck.
Tolerance warning. When a claim sets no tolerance, the default is 10% of the baseline mean, which
can mislead in two cases, and the audit then attaches a warning to the claim and its verdicts (in
results.json, report.html and the console). Either the default tolerance is smaller than the standard
error of the baseline mean, so the seeds cannot resolve it; or the baseline mean is below 0.01 in
absolute value, so 10% of it is a tiny absolute margin. The second test is in the metric’s own units:
most claim metrics are fractions or counts, where 0.01 is close to zero. The warning never changes a
verdict; set an absolute tolerance on the claim to decide what size of change matters.
Verdict rules, in order¶
SKIPPEDif the claim lists the check inskip_checks.NOT_TESTABLEif the model does not declare the knob.BASELINE_FAILSif the claim fails at baseline.determinism:FRAGILEif any rerun differs at all, otherwiseROBUST.Zero between-seed variance at baseline:
FRAGILEforrng_streams(the seed has no effect),INCONCLUSIVEfor the other checks.INCONCLUSIVEif the claim is uncertain at baseline.FRAGILEif the claim fails under any variant.SHIFTEDif any mean or spread comparison is shifted.INCONCLUSIVEif anything is uncertain or undetermined, withseeds_needed.ROBUSTotherwise.
Seeds needed¶
For an interval of half-width h from n seeds that misses a decision boundary by g, ABMfact reports
ceil(n * (h / g)^2), capped at 10 000. It is a planning figure, not a guarantee.
Multiple comparisons¶
An audit makes many comparisons: checks times variants times parameter points times claims. No
correction is applied to the mean comparisons, because the equivalence decision needs the whole interval
outside the tolerance, which is conservative for practical differences. Spread uses a tenfold stricter
level. Even so, read a single marginal SHIFTED as a lead to investigate with more seeds, not as a
conclusion.
Determinism of the audit¶
Seeds are seed_start, seed_start + 1, .... Every condition uses the same seeds. Permutation seeds for
agent_order and remapped seeds for rng_streams are derived from each seed with
numpy.random.SeedSequence. With the same audit file and versions, results.json is identical apart
from its created timestamp, whether runs are serial or parallel.