# P-values and exposure

This is a synthetic arithmetic example, not a fleet experiment or a
general-purpose statistical package. Inputs are invented counts (10,20) and
(100,200) with equal fixed exposures of 1,000 and 10,000 drive-years per group.
Both comparisons give 1 versus 2 events per 100 drive-years.

Assume independent Poisson counts with means lambda_A E_A and lambda_B E_B.
Under equal rates and equal fixed exposures, conditional on n = A+B,
A is Binomial(n,1/2). For the prechosen two-sided test, sum allocations
at least as far from n/2 as observed. Symmetry gives
min(1, 2 sum[k=0..min(A,B)] choose(n,k) / 2^n).

The integer numerator and denominator are exact; pValue is a floating-point
display approximation. The helper rejects unequal exposures, invalid counts,
zero total events and totals above 1,000. Zero total is uninformative here;
this is a local contract, not a claim that R rejects that input.
The bound keeps final Number conversion finite and arithmetic work limited.
No effect-size interval, equivalence test, multiple-comparison correction
or stopping-rule adjustment is computed. Counts need not represent distinct
drive failures unless an observation model supports that interpretation.

## Replay
With Node.js supporting ESM and BigInt, run from this directory:

    node --test model.test.mjs
    node model.mjs --check

To regenerate the checked-in results:

    node model.mjs

No downloads, random seeds, dependencies or device access are required.
The results are calculated independently using binomial coefficients; no R
implementation code is copied.

## Primary method references
- R stats poisson.test documentation (accessed 2026-11-19):
  https://stat.ethz.ch/R-manual/R-patched/library/stats/html/poisson.test.html
- Pinned R 4.5.2 poisson.test.R, lines 48-61, conditional-binomial mapping:
  https://svn.r-project.org/R/tags/R-4-5-2/src/library/stats/R/poisson.test.R
- Pinned R 4.5.2 binom.test.R, lines 49-85, two-sided probability ordering:
  https://svn.r-project.org/R/tags/R-4-5-2/src/library/stats/R/binom.test.R
- ASA 2016 six-principle summary, p-value interpretation:
  https://www.amstat.org/asa/files/pdfs/P-ValueStatement.pdf

References establish the method and interpretation, not the realism of these
inputs. Heterogeneous hazards, dependent failures, informative withdrawal or
data-dependent selection require a different analysis.
