Invntr
Source

All instruments

hypothesis_test

Classical tests on small data sets: one-sample, paired and two-sample t (Student and Welch), one-way ANOVA, chi-square goodness of fit and independence, or a plain p-value from a t, z, chi-square or F statistic. Gives the statistic, degrees of freedom, exact p-value (own incomplete beta and gamma functions), critical value, effect size and confidence interval.

Field
Measurement and data
Version
0.1.0
Runs as
Compiled (Rust)
Typical run
0.05 s

Compiled from source: run sh packs/install.sh once before admitting it.

Known answers it must pass

Admission replayhypothesis_test 0.1.0 · files c02180cc8c4e…d08b
  1. r0001Cauchy closed form: t with 1 df, two-sided p(t = 1) = 1 - (2/pi) atan(1) = 0.5, tails 1/4 and 3/4passed

    p_value0.5 ± 5e-070.5lockedunder 0.01 % of the tolerance used
    p_upper0.25 ± 2.5e-070.25lockedunder 0.01 % of the tolerance used
    p_lower0.75 ± 7.5e-070.75lockedunder 0.01 % of the tolerance used
  2. r0002Cauchy closed form: t with 1 df, upper tail of t = sqrt(3) is 1/2 - atan(sqrt 3)/pi = 1/6passed

    p_value0.166667 ± 1.7e-070.166667lockedunder 0.01 % of the tolerance used
  3. r0003t with 2 df closed form p = 1 - t/sqrt(t^2+2): p(4.302652729749464) = 0.05, and the 5 % critical value is sqrt(2*0.9025/0.0975) (textbook 4.3027)passed

    p_value0.05 ± 5e-080.05lockedunder 0.01 % of the tolerance used
    critical_value4.30265 ± 4.3e-064.30265lockedunder 0.01 % of the tolerance used
  4. r0004chi-square with 2 df closed form p = exp(-x/2): p(-2 ln 0.05 = 5.9915) = 0.05, critical value 5.991464547107982passed

    p_value0.05 ± 5e-080.05lockedunder 0.01 % of the tolerance used
    critical_value5.99146 ± 6e-065.99146lockedunder 0.01 % of the tolerance used
  5. r0005chi-square with 2 df closed form p = exp(-x/2) deep in the tail: p(40) = exp(-20)passed

    p_value2.06115e-09 ± 2.1e-152.06115e-09lockedunder 0.01 % of the tolerance used
  6. r0006F(1, 2) = t(2)^2: F = 18.51282051282051 (= 4.3027^2) gives p = 0.05 and is its own 5 % critical valuepassed

    p_value0.05 ± 5e-080.05lockedunder 0.01 % of the tolerance used
    critical_value18.5128 ± 1.9e-0518.5128lockedunder 0.01 % of the tolerance used
  7. r0007normal: two-sided p(z = 1.96) = erfc(1.96/sqrt 2) = 0.04999579029644086; 5 % critical value is the textbook 1.959963984540054passed

    p_value0.0499958 ± 5e-080.0499958lockedunder 0.01 % of the tolerance used
    critical_value1.95996 ± 2e-061.95996lockedunder 0.01 % of the tolerance used
  8. r0008large df limit: t with 1e6 df, p(1.96) tends to the normal 0.0499958; tolerance 1e-6 absolute because the t-to-normal gap is of order 1/df (about 3e-7 here)passed

    p_value0.0499958 ± 1e-060.0499961locked28 % of the tolerance used
  9. r0009Student pooled t by hand, [1,2,3] vs [4,5,6]: t = -3/sqrt(2/3), df 4, p from the 4-df closed form 1 - x(1 + (1-x^2)/2) with x = t/sqrt(t^2+4), d = -3, Hedges g = -3 sqrt(2/pi)passed

    statistic-3.67423 ± 3.7e-06-3.67423lockedunder 0.01 % of the tolerance used
    df4 ± 4e-064lockedunder 0.01 % of the tolerance used
    p_value0.0213116 ± 2.1e-080.0213116lockedunder 0.01 % of the tolerance used
    cohen_d-3 ± 3e-06-3lockedunder 0.01 % of the tolerance used
    hedges_g-2.39365 ± 2.4e-06-2.39365lockedunder 0.01 % of the tolerance used
    estimate-3 ± 3e-06-3lockedunder 0.01 % of the tolerance used
    pooled_sd1 ± 1e-061lockedunder 0.01 % of the tolerance used
    reject_null= truetruelockedexact match
  10. r0010identical group means: Welch t on [1,2,3] vs [3,2,1] gives t = 0, p = 1, df 4 (equal variances and sizes)passed

    statistic0 ± 1e-120lockedunder 0.01 % of the tolerance used
    p_value1 ± 1e-121lockedunder 0.01 % of the tolerance used
    df4 ± 4e-064lockedunder 0.01 % of the tolerance used
    reject_null= falsefalselockedexact match
  11. r0011one-sample t by hand, [5,7,9] against mu0 = 5: t = sqrt 3, df 2, p = 1 - sqrt(3/5), 95 % interval 7 +- 4.3027*2/sqrt 3, d = 1passed

    statistic1.73205 ± 1.7e-061.73205lockedunder 0.01 % of the tolerance used
    df2 ± 2e-062lockedunder 0.01 % of the tolerance used
    p_value0.225403 ± 2.3e-070.225403lockedunder 0.01 % of the tolerance used
    ci_low2.03172 ± 2e-062.03172lockedunder 0.01 % of the tolerance used
    ci_high11.9683 ± 1.2e-0511.9683lockedunder 0.01 % of the tolerance used
    se1.1547 ± 1.2e-061.1547lockedunder 0.01 % of the tolerance used
    cohen_d1 ± 1e-061lockedunder 0.01 % of the tolerance used
  12. r0012Welch t by hand, [0,2] vs [3,5]: t = -3/sqrt 2, Welch-Satterthwaite df = 2, p = 1 - |t|/sqrt(t^2+2)passed

    statistic-2.12132 ± 2.1e-06-2.12132lockedunder 0.01 % of the tolerance used
    df2 ± 2e-062lockedunder 0.01 % of the tolerance used
    p_value0.16795 ± 1.7e-070.16795lockedunder 0.01 % of the tolerance used
  13. r0013Welch-Satterthwaite by hand, [1,2,3,4,5] vs [2,4,6]: t = -1/sqrt(11/6), df = 484/137passed

    statistic-0.738549 ± 7.4e-07-0.738549lockedunder 0.01 % of the tolerance used
    df3.53285 ± 3.5e-063.53285lockedunder 0.01 % of the tolerance used
    se1.35401 ± 1.4e-061.35401lockedunder 0.01 % of the tolerance used
  14. r0014paired t by hand, [10,12,14] vs [5,5,5]: differences 5,7,9, t = 7 sqrt(3)/2, df 2, p = 1 - t/sqrt(t^2+2)passed

    statistic6.06218 ± 6.1e-066.06218lockedunder 0.01 % of the tolerance used
    df2 ± 2e-062lockedunder 0.01 % of the tolerance used
    p_value0.0261483 ± 2.6e-080.0261483lockedunder 0.01 % of the tolerance used
    estimate7 ± 7e-067lockedunder 0.01 % of the tolerance used
  15. r0015one-way ANOVA of two groups equals t^2: [[1,2,3],[4,5,6]] gives F = 13.5 on (1, 4) df, the same p as the pooled t (0.0213116...), eta squared = 13.5/17.5passed

    statistic13.5 ± 1.3e-0513.5lockedunder 0.01 % of the tolerance used
    df1 ± 1e-061lockedunder 0.01 % of the tolerance used
    df24 ± 4e-064lockedunder 0.01 % of the tolerance used
    p_value0.0213116 ± 2.1e-080.0213116lockedunder 0.01 % of the tolerance used
    eta_squared0.771429 ± 7.7e-070.771429lockedunder 0.01 % of the tolerance used
    ss_between13.5 ± 1.3e-0513.5lockedunder 0.01 % of the tolerance used
    ss_within4 ± 4e-064lockedunder 0.01 % of the tolerance used
  16. r0016goodness of fit by hand, [30,10,20] against equal shares: chi2 = 10, df 2, p = exp(-5), Cohen w = sqrt(1/6)passed

    statistic10 ± 1e-0510lockedunder 0.01 % of the tolerance used
    df2 ± 2e-062lockedunder 0.01 % of the tolerance used
    p_value0.00673795 ± 6.7e-090.00673795lockedunder 0.01 % of the tolerance used
    cohens_w0.408248 ± 4.1e-070.408248lockedunder 0.01 % of the tolerance used
  17. r0017independence by hand, [[20,10,30],[10,20,30]]: chi2 = 20/3, df 2, p = exp(-10/3), Cramer V = sqrt(1/18)passed

    statistic6.66667 ± 6.7e-066.66667lockedunder 0.01 % of the tolerance used
    df2 ± 2e-062lockedunder 0.01 % of the tolerance used
    p_value0.035674 ± 3.6e-080.035674lockedunder 0.01 % of the tolerance used
    cramers_v0.235702 ± 2.4e-070.235702lockedunder 0.01 % of the tolerance used
  18. r00182 x 2 with Yates by hand, [[10,20],[20,10]]: chi2 = 4*(4.5^2)/15 = 5.4, df 1, p = erfc(sqrt 2.7)passed

    statistic5.4 ± 5.4e-065.4lockedunder 0.01 % of the tolerance used
    df1 ± 1e-061lockedunder 0.01 % of the tolerance used
    p_value0.0201368 ± 2e-080.0201368lockedunder 0.01 % of the tolerance used
    phi0.3 ± 3e-070.3lockedunder 0.01 % of the tolerance used
  19. r0019chi-square with 4 df closed form p = exp(-x/2)(1 + x/2): p(6) = 4 exp(-3)passed

    p_value0.199148 ± 2e-070.199148lockedunder 0.01 % of the tolerance used
  20. r0020F(2, 4) closed form p = (1 + f/2)^-2: p(3) = 0.16, 5 % critical value 2(sqrt 20 - 1)passed

    p_value0.16 ± 1.6e-070.16lockedunder 0.01 % of the tolerance used
    critical_value6.94427 ± 6.9e-066.94427lockedunder 0.01 % of the tolerance used
  21. r0021Cauchy closed form, one-sided critical values past the median: t with 1 df, alternative greater, alpha = 0.75 has critical value tan(pi(1/2 - 3/4)) = -1; p(t = 1) = 1/4passed

    critical_value-1 ± 1e-06-1lockedunder 0.01 % of the tolerance used
    p_value0.25 ± 2.5e-070.25lockedunder 0.01 % of the tolerance used
    reject_null= truetruelockedexact match
  22. r0022Cauchy closed form: t with 1 df, alternative less, alpha = 0.75 has critical value +1; p(t = 1) = 3/4passed

    critical_value1 ± 1e-061lockedunder 0.01 % of the tolerance used
    p_value0.75 ± 7.5e-070.75lockedunder 0.01 % of the tolerance used
  23. r0023non-integer df, F(2, n) closed form p = (1 + 2f/n)^(-n/2) for any n: F(2, 484/137) at f = 1.7passed

    p_value0.303959 ± 3e-070.303959lockedunder 0.01 % of the tolerance used
  24. r0024non-integer df, F(m, 2) closed form p = 1 - (m f/(2 + m f))^(m/2) for any m: F(2.7, 2) at f = 3.3passed

    p_value0.239198 ± 2.4e-070.239198lockedunder 0.01 % of the tolerance used
  25. r0025three-group ANOVA by hand, [[1,2,3],[2,3,4],[5,6,7]]: SSB = 26, SSW = 6, F = 13 on (2, 6) df, p = (1 + 2*13/6)^-3 = 27/4096 exactlypassed

    statistic13 ± 1.3e-0513lockedunder 0.01 % of the tolerance used
    df2 ± 2e-062lockedunder 0.01 % of the tolerance used
    df26 ± 6e-066lockedunder 0.01 % of the tolerance used
    p_value0.0065918 ± 6.6e-090.0065918lockedunder 0.01 % of the tolerance used
    ss_between26 ± 2.6e-0526lockedunder 0.01 % of the tolerance used
    ss_within6 ± 6e-066lockedunder 0.01 % of the tolerance used
    eta_squared0.8125 ± 8.1e-070.8125lockedunder 0.01 % of the tolerance used
  26. r0026Welch p at non-integer df 484/137, [1,2,3,4,5] vs [2,4,6]: NOT a closed form; p = 0.50621417165285 from Simpson integration of the t density (python math, 200000 panels, two routes agreeing to 1.4e-14), independent of this programpassed

    p_value0.506214 ± 5.1e-070.506214lockedunder 0.01 % of the tolerance used
26 of 26 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.

Inputs

NameUnitDefaultMeaning
testwelch_tWhich test to run.
xFirst sample (t tests). Any one unit; the estimate and interval come back in it.
ySecond sample (paired, two-sample and Welch t), same unit as x.
mu00.0Null value of the mean (one-sample) or of the mean difference (paired, two-sample), in the unit of x.
groupsANOVA: one list of values per group.
observedGoodness of fit: observed counts per category.
expectedGoodness of fit: expected counts or proportions per category (rescaled to the observed total). Left out: equal shares.
ddof10Goodness of fit: parameters estimated from the data, taken off the degrees of freedom.
tableIndependence: contingency table of counts, rows by columns.
yatesfalseIndependence: Yates' continuity correction (2 x 2 tables only).
statistic1p_value: the statistic to convert.
distributiontp_value: the null distribution.
df1p_value: degrees of freedom (numerator for F). At most 1e6: above that the p-value loses digits and the run is refused.
df21p_value: denominator degrees of freedom for F. At most 1e6: above that the p-value loses digits and the run is refused.
alternativetwo_sidedAlternative hypothesis for t and z. Chi-square and F are always upper-tailed.
alpha10.05Significance level.
confidence10.95Confidence level of the intervals.

Readings

NameUnitMeaning
statistic1
df1
df21
p_value1
p_two_sided1
p_upper1
p_lower1
critical_value1
alpha1
confidence1
cohen_d1
hedges_g1
eta_squared1
omega_squared1
cohens_w1
cramers_v1
phi1
effect_size1
n_total1

Try the call

Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.

Terminal
MCP call