v2026.11.2
All Bundles
Bundle

Classical statistics for small analyses: descriptive statistics, the Student t, normal, chi-square and F distributions, t-tests with confidence intervals and effect sizes, Pearson correlation with a p-value, and an ordinary least squares fit with the full summary table (standard errors, t statistics, p values, confidence intervals, F test, R-squared, AIC and BIC). Compile with -lib stats,gen_collect; it needs nothing from System.ML.

No call here ends the program on bad input. A function that returns a Float returns NaN, and a function that returns a result object returns one whose IsValid() is false and whose GetError() says why. Design and verification notes: docs/AI.md, "Statistics".

CorrelationResult

The outcome of a correlation test. A failed one (IsValid() false) has NaN in every number.

Operations

GetCiHigh #

Upper end of the Fisher-z confidence interval for r (NaN when n is 3 or less).

method : public : GetCiHigh() ~ Float

Return

TypeDescription
Floatupper bound

GetCiLow #

Lower end of the Fisher-z confidence interval for r (NaN when n is 3 or less).

method : public : GetCiLow() ~ Float

Return

TypeDescription
Floatlower bound

GetDf #

Degrees of freedom, n - 2.

method : public : GetDf() ~ Float

Return

TypeDescription
Floatdegrees of freedom

GetError #

Why the test did not run, or an empty string.

method : public : GetError() ~ String

Return

TypeDescription
Stringreason

GetN #

Number of pairs.

method : public : GetN() ~ Int

Return

TypeDescription
Intcount

GetP #

Two-sided p-value for the null hypothesis of no correlation.

method : public : GetP() ~ Float

Return

TypeDescription
Floatp

GetR #

The correlation coefficient, between -1 and 1.

method : public : GetR() ~ Float

Return

TypeDescription
Floatr

GetT #

The t statistic r * sqrt((n - 2) / (1 - r^2)).

method : public : GetT() ~ Float

Return

TypeDescription
Floatt

IsValid #

Whether the test ran.

method : public : IsValid() ~ Bool

Return

TypeDescription
Booltrue if every number is meaningful