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".
TTestResult
The outcome of a t-test. A failed test (IsValid() false) has NaN in every number and GetError() set.
The mean difference is the first group minus the second (or the sample mean minus the hypothesised mean for a one-sample test, or the mean of the pairwise differences for a paired one). The confidence interval is for that difference.
Operations
- GetCiHigh
- GetCiLow
- GetCohenD
- GetDf
- GetError
- GetHedgesG
- GetLevel
- GetMean1
- GetMean2
- GetMeanDiff
- GetMethod
- GetN1
- GetN2
- GetP
- GetStdError
- GetT
- IsSignificant
- IsValid
GetCiHigh #
Upper end of the confidence interval for the difference.
method : public : GetCiHigh() ~ FloatReturn
| Type | Description |
|---|---|
| Float | upper bound |
GetCiLow #
Lower end of the confidence interval for the difference.
method : public : GetCiLow() ~ FloatReturn
| Type | Description |
|---|---|
| Float | lower bound |
GetCohenD #
Cohen's d: the mean difference over the pooled standard deviation (two-sample), or over the standard deviation of the sample (one-sample) or of the differences (paired).
method : public : GetCohenD() ~ FloatReturn
| Type | Description |
|---|---|
| Float | d |
GetDf #
Degrees of freedom (fractional for the Welch test).
method : public : GetDf() ~ FloatReturn
| Type | Description |
|---|---|
| Float | degrees of freedom |
GetError #
Why the test did not run, or an empty string.
method : public : GetError() ~ StringReturn
| Type | Description |
|---|---|
| String | reason |
GetHedgesG #
Hedges' g: Cohen's d times the exact small-sample correction Gamma(df/2) / (sqrt(df/2) * Gamma((df-1)/2)) (see Dist->HedgesJ).
method : public : GetHedgesG() ~ FloatReturn
| Type | Description |
|---|---|
| Float | g |
GetLevel #
Confidence level the interval was made at.
method : public : GetLevel() ~ FloatReturn
| Type | Description |
|---|---|
| Float | level, such as 0.95 |
GetMean1 #
Mean of the first sample.
method : public : GetMean1() ~ FloatReturn
| Type | Description |
|---|---|
| Float | mean |
GetMean2 #
Mean of the second sample, or the hypothesised mean for a one-sample test.
method : public : GetMean2() ~ FloatReturn
| Type | Description |
|---|---|
| Float | mean |
GetMeanDiff #
Mean difference: first minus second.
method : public : GetMeanDiff() ~ FloatReturn
| Type | Description |
|---|---|
| Float | difference |
GetN1 #
Size of the first sample (or the only one).
method : public : GetN1() ~ IntReturn
| Type | Description |
|---|---|
| Int | count |
GetN2 #
Size of the second sample, 0 for a one-sample test.
method : public : GetN2() ~ IntReturn
| Type | Description |
|---|---|
| Int | count |
GetStdError #
Standard error of the mean difference.
method : public : GetStdError() ~ FloatReturn
| Type | Description |
|---|---|
| Float | standard error |