Skip to content

Stats andersonresult gethashcode

github-actions[bot] edited this page Sep 24, 2026 · 4 revisions

Development build. This page describes main, not a released package. The latest published Lodestar.Stats is 0.5.0 — read its documentation.

Home › Stats › Hypothesis tests

AndersonResult.GetHashCode

Hashes the scalars and the table length, which is O(1).

public int GetHashCode()

Returns — a hash of the statistic, the p-value and the number of critical values.

Example — equal results hash equally, which is the contract a dictionary needs.

using Lodestar.Stats;

AndersonResult left = new(0.5, 0.1, [0.5, 0.6], [15.0, 10.0]);
AndersonResult right = new(0.5, 0.1, [0.5, 0.6], [15.0, 10.0]);

bool agree = left.GetHashCode() == right.GetHashCode();  // => True

Remarks — the tables are not walked. Equal results necessarily agree on the table length, so the contract holds; unequal ones may collide, which a hash is allowed to do. Walking both tables would make the cheap operation cost what the test itself cost, and Chi2ContingencyResult.GetHashCode is written the same way.

Applies to — net10.0, netstandard2.0.

See also — AndersonResult, AndersonResult.Equals, the Python equivalence table.

Clone this wiki locally