Stats andersonresult gethashcode - CyrilB1531/lodestar GitHub Wiki
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
ChiSquaredContingencyResult.GetHashCode is written the same
way.
Applies to — net10.0, netstandard2.0.
See also — AndersonResult,
AndersonResult.Equals, the
Python equivalence table.