How these numbers are computed and checked
Every function is verified against R, tail probabilities never cancel, and the limits are stated rather than hidden.
This page describes how the numbers on this site are computed and how they are checked. It exists because "trust us" is not a reasonable thing to ask of a statistics tool.
The reference
Every statistical function is verified against R, the reference implementation used across academia and industry. The expected values in the test suite are generated by an R script and stored in the repository; the JavaScript engine is then run against them in a real browser. Where R and this site disagree by more than the tolerance stated in the test, the test fails and the build is not shipped.
A handful of results are deliberately checked against something other than R:
- Mathematical identities that hold regardless of implementation — F(1, df) equals t² on df degrees of freedom, chi-square with 1 degree of freedom is the squared normal, the studentized range with k = 2 is √2 times the two-sided t, the exact Mann-Whitney counts sum to C(n₁+n₂, n₁). These would catch an error in the reference file itself.
- Definitions, where a package converges loosely. R finds the conditional maximum-likelihood odds ratio in
fisher.testwithunirootat its default tolerance, roughly 1.2 × 10⁻⁴ relative; this site solves the same equation to machine precision and verifies it by checking that the defining equation E[X | ψ] = observed actually holds.
Numerical care
Three rules apply throughout, and each one exists because the obvious alternative is wrong:
Tail probabilities are computed directly, never as one minus the CDF. At z = −8 the normal CDF is 6.22 × 10⁻¹⁶. Computing it as 1 − Φ(8) in double precision leaves a number whose relative error is around 16%, because almost every significant digit cancels. Every survival function here is written in the form that does not cancel, which is why a p-value of 10⁻¹⁵ is still correct to several figures.
Variances use Welford's online algorithm. The textbook shortcut Σx² − (Σx)²/n is algebraically identical and numerically catastrophic: on values near 10⁹ it can return a negative variance. Sums use compensated (Neumaier) summation for the same reason.
Factorials and binomial coefficients are computed in log space. 171! overflows a double. C(1000, 500) is about 2.7 × 10²⁹⁹. Both are routine here because nothing is ever computed as a ratio of factorials — everything goes through log-gamma.
Specific methods
| Quantity | Method |
|---|---|
| log-gamma | Lanczos approximation, g = 7, n = 9 |
| incomplete gamma | series below a+1, modified Lentz continued fraction above |
| incomplete beta | modified Lentz continued fraction with the symmetry transform |
| normal quantile | Acklam's rational approximation, refined once by Halley's method |
| t, chi-square, F quantiles | bracketed bisection on the CDF, 200 iterations |
| studentized range (Tukey) | 40-point Gauss-Legendre quadrature over the chi and range integrals |
| non-central t | Lenth (1989), AS 243 — used for exact power and sample size |
| Mann-Whitney, Wilcoxon | exact null distributions by dynamic programming; normal approximation with tie correction otherwise |
| Fisher's exact test | full hypergeometric enumeration in log space; conditional MLE odds ratio and exact interval |
| Shapiro-Wilk | Royston (1995), AS R94 |
| logistic regression | iteratively reweighted least squares (Fisher scoring) |
What is deliberately not implemented
Being honest about the edges is part of being trustworthy:
- Two-way and repeated-measures ANOVA. The ANOVA calculator is one-way only, including Welch's unequal-variance version. Factorial designs need software with a model formula.
- Fisher's exact test beyond 2×2. The r × c exact test is a much larger computation and is not offered; the page says so rather than silently approximating.
- Mixed models, survival analysis, time series, Bayesian inference. All out of scope.
- Multiple-comparison corrections beyond Tukey's HSD. Bonferroni is arithmetic you can do in your head; anything more elaborate is not here.
Rounding and display
Results are shown to enough significant figures to be useful and no more. p-values below 0.0001 are reported as "< 0.0001" with the exact value available in the step table, which is the convention in the journals. Internally every calculation carries full double precision; rounding happens only at display.
Quantile conventions
There are at least four accepted definitions of a quartile and they genuinely disagree on small samples. This site names the one it used on every page that computes them, and the percentile calculator shows all four side by side so a mismatch with your spreadsheet is explainable rather than mysterious.
Reporting an error
Send the calculator, the inputs, the output and what you expected to the address on the contact page. Every confirmed error becomes a regression test naming its source, so the same mistake cannot return in a later revision.