Tool
exactcdf: the engine behind the p-value
In statistics we learn to read a p-value as if it came from nature. We copy it from SPSS, from a table at the back of the book or from an online calculator, and move on. But behind every p-value there is a function someone programmed: the normal distribution, the chi-squared, the beta. If that function is wrong in the tail, which is exactly where small p-values live, the error gives no warning.
exactcdf is my answer to that: a small library that computes those functions and that, before computing anything, puts in writing how wrong it is allowed to be in each region. Then it checks.
What it is for in psychology
- From a z score to a percentile:
pnorm. It is the arithmetic behind a normalised norm table. - The p-value of a chi-squared test, for independence in a contingency table or for goodness of fit:
pchisq. - The exact p-value of a binomial test, for instance how many hits there are above chance: it comes out of
pbeta. - The cumulative probability of a count (Poisson): it comes out of
pgamma.
It does not yet compute Student's t or the inverses (from a percentile to a z score, for example). Their references are already in the repository and they will arrive by the same road: tolerances first, code second.
The calculator that is coming
On top of exactcdf I am building a calculator for scoring psychological instruments, designed to serve any instrument rather than a single one, with code that can be audited. It is not published yet; when it is, it will live on this site.
How we know it is right
The references were computed with mpmath to 70 digits and went into the repository on 13 October 2026; the tolerances were fixed between 21 and 25 October; the code came on the 29th. Setting the tolerance after seeing the results is drawing the bullseye around the arrow. The current release passes all 31,307 reference rows with no failures. In the hardest tails the tolerance is still provisional, and it is marked as such in the repository.
How it was made
The code was written by Anthropic AI models from a specification I approved, derived from the primary literature (Cody, 1969; DiDonato and Morris, 1986 and 1992). The references were not produced by AI: they were computed with R and mpmath. I directed the project, made the design decisions and signed off each release. The full statement is on the technical page.
Install, read, cite
Install it with npm install exactcdf (Node.js 18 or later). The full technical page —the eight functions, the error table, the license and how to cite it— is at carlosravello.com/exactcdf-en. The code is on GitHub and the package on npm.