Test suites
Verification
Models
- OLS
- Logistic regression
- Probit regression
- Poisson regression
- Linear mixed model
- Linear mixed model, published data
- Binomial mixed model
- R compatibility
Numerics
Test suites
On this page
Scope
Every PHP test suite in the release check: saved references from R, lme4, mpmath, Python, and phibble, and phit's own contracts.
References
- Reference
- Saved reference fixtures; the reference manifest lists each one's generator, versions, and hash
Data
- Fixture provenance
- generators, versions, hashes, and tolerance policies Source
Method
Each suite runs against the release build of the extension. Its exit status and its own summary line are recorded; each row is one suite.
- Check
- Comparison with a reference implementation
- Recorded
- 2026-11-01, PHP 8.5.10, macOS 27.0.1 (arm64), commit 066e2e1
Tolerances
exact equality
Applies to: Exact results
Results, row accounting, parsed values, types, errors
|x − r| ≤ 1e-9 + 1e-7 × |r|
Applies to: Model fixtures
OLS and GLMs
|x − r| ≤ 1e-12 + 1e-12 × |r|
Applies to: Model matrices
Columns, terms, and rows exact; lm and glm fits 1e-9 + 1e-7·|r|
|x − r| ≤ 1e-5 + 1e-5 × |r|
Applies to: Mixed-model estimates
Likelihood 5e-6 + 1e-9·|r|; glmer as in the binomial mixed model
|x − r| ≤ 1e-7 + 1e-6 × |r|
Applies to: Predictions
Fits, intervals, standard errors
|x − r| ≤ 1e-7 + 1e-6 × |r|
Applies to: Weighted and offset GLMs
|x − r| ≤ 1e-10
Applies to: Exposure intercept and standard error
Likelihood and counts 1e-9
|x − r| ≤ 1e-300 + 1e-12 × |r|
Applies to: Distribution functions
Logarithms relative to max(1, |r|), quantiles 1e-15 + 1e-12·|r|
|x − r| ≤ 1e-12 × |r|; at r = 0, x = 0 exactly
Applies to: Descriptive statistics and smoothing
Zeros, ECDF counts, and type-7 identities exact
|x − r| ≤ 1e-15 + 1e-12 × |r|
Applies to: Sampling
ChaCha uniforms and discrete samples exact
|x − r| ≤ 1e-11 + 1e-11 × |r|
Applies to: Posterior-draw kernels
Moments, covariance maps, affine draws, log determinants
as stated in the record
Applies to: Extreme inputs
Per-case tolerances stored with the fixture
x: package value; r: reference value.
Results
24 comparisons: 24 pass, 0 fail, 0 skipped.
| Case | Quantity | Criterion | Values | Status |
|---|---|---|---|---|
| OLS against saved R lm() fixtures | PHP OLS integration tests passed | |x − r| ≤ 1e-9 + 1e-7 × |r| | pass | |
| Logistic regression against saved R glm() fixtures | PHP logistic integration tests passed | |x − r| ≤ 1e-9 + 1e-7 × |r| | pass | |
| Probit regression against saved R glm() fixtures | PHP probit integration tests passed | |x − r| ≤ 1e-9 + 1e-7 × |r| | pass | |
| Poisson regression against saved R glm() fixtures | PHP poisson integration tests passed | |x − r| ≤ 1e-9 + 1e-7 × |r| | pass | |
| Deprecated aliases return their replacement's result | PHP 0.4 names: 10 deprecated aliases and fit_ols dispatch passed | exact equality | pass | |
| Formula designs against R model.matrix(), and lm()/glm() fits | PHP formula tests passed (33 model.matrix, 14 lm, 15 glm fits; 30007 R comparisons) | |x − r| ≤ 1e-12 + 1e-12 × |r| | 30,007 | pass |
| Formula mixed models against lme4 lmer() and glmer() | PHP formula mixed-model tests passed (7 lmer and 3 glmer lme4 fits; 782 comparisons) | |x − r| ≤ 1e-5 + 1e-5 × |r| | 782 | pass |
| predict() against R predict() | PHP predict tests passed (25 R predict() cases; 877 comparisons) | |x − r| ≤ 1e-7 + 1e-6 × |r| | 877 | pass |
| Random intercept against saved lme4 fixtures | PHP mixed-model integration tests passed | |x − r| ≤ 1e-5 + 1e-5 × |r| | pass | |
| Weighted and offset GLMs against base R | PHP base-R compatibility tests passed | |x − r| ≤ 1e-7 + 1e-6 × |r| | pass | |
| Mixed-model structures against four lme4 optimizers | PHP expanded mixed-model tests passed (15 models, four lme4 optimizers) | |x − r| ≤ 1e-5 + 1e-5 × |r| | pass | |
| Binomial random intercept against lme4 glmer() | PHP binomial random-intercept integration tests passed (28 lme4 fits) | |x − r| ≤ 1e-5 + 1e-5 × |r| | pass | |
| Result contracts and exception categories | PHP stability, result contracts and exception categories passed | exact equality | pass | |
| Automatic intercepts and Poisson exposure offsets | PHP automatic intercepts and Poisson exposure offsets passed | |x − r| ≤ 1e-10 | pass | |
| Distribution functions against R and mpmath | PHP distribution tests passed (8618 comparisons, 25 independently adjudicated references, 43 documented boundary differences) | |x − r| ≤ 1e-300 + 1e-12 × |r| | 8,618 | pass |
| Descriptive statistics against R | PHP descriptive tests passed (145 R comparisons, missing policies and validation) | |x − r| ≤ 1e-12 × |r|; at r = 0, x = 0 exactly | 145 | pass |
| Kernel densities, bandwidths, interpolation, and ECDF against R | PHP smoothing tests passed (15639 R comparisons, missing policies and validation) | |x − r| ≤ 1e-12 × |r|; at r = 0, x = 0 exactly | 15,639 | pass |
| optimize() and uniroot() against R | PHP optimize/uniroot tests passed (91 bit-for-bit R comparisons, evaluation counts and validation) | exact equality | 91 | pass |
| Seeded sampling against independent ChaCha streams and R quantiles | PHP RNG tests passed (3764 independent R/ChaCha values, seed isolation, validation and moments; uniform, categorical and permutation samplers) | |x − r| ≤ 1e-15 + 1e-12 × |r| | 3,764 | pass |
| Posterior-draw kernels against 80-digit Python references | 25 independent draw fixtures, identities and strict input contracts passed | |x − r| ≤ 1e-11 + 1e-11 × |r| | pass | |
| CSV reader: parsing rules, options, types, and errors | csv: 190 checks passed | exact equality | 190 | pass |
| CSV reader against phibble's reader on a fixed corpus | csv-conformance: 120 cases matched phibble's reader, at every block size and in chunks | exact equality | 120 | pass |
| CSV reader against phibble's PHP reader on generated files | csv-phibble: 6278 comparisons against phibble's PHP reader passed | exact equality | 6,278 | pass |
| Extreme but identified inputs against base R | PHP extreme-input checks passed | as stated in the record | pass |
Reproduction
cargo build -p phit --release --locked
PHP=$(command -v php) python3 docs/verifications/run_test_suites.py
- Raw record
- site/verifications/test-suites.json
- Full results
- docs/verifications/test-suites-results.json