chi2_gof_test

std.stats.chi2_gof_test · Level L5

Pearson's chi-square goodness-of-fit test: [X², p] with X² = Σ (oᵢ − eᵢ)²/eᵢ over n categories and p = Q((n − 1)/2, X²/2), the chi-square upper tail with n − 1 degrees of freedom.

X² = Σᵢ (oᵢ − eᵢ)²/eᵢ, p = Q((n − 1)/2, X²/2)

Signature

chi2_gof_test(observed: f64[n], expected: f64[n]) → f64[2]

Requires: n ≥ 2

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

expectedf64[n]observedf64[n]SubtractdSizen1.0Multiplyd20.5SubtractdfDividetermsMultiplyaReduceSumstatReshapestat1MultiplysGammaIncCpReshapep1Concatoutoutf64[2]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size with n ≥ 2.
  • Agrees with the reference X² exactly; p by the chi-square survival function's closed forms for whole degrees of freedom to 80 digits (100-digit arithmetic), on all 40 test cases.
  • All 80 float64 results inside the running error bound; the closest uses 58% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
53%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
188

Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.

Identity

Calls
—
Called by
—
sha256:a6d900b5408e72904ff261594ee505b1da0b17136f1ab8c5f75800022b674103

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.stats.chi2_gof_test · Ω:chi2_gof_test
Pins
sha256:14635a4e850c6560acc6958ae7e07467388a70fbf79fe275441dd11bfcd09b1cthis graph alone
Evidence
sha256:fbf4393ef46d97b91d9c705cb0f09dc3621ddfccb9f42e67b1a3590efaaf03eethe hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.

ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.