Package: poissonexact 0.1.0

Ali Charkhi

poissonexact: Exact Conditional Inference for Poisson Regression

Compute exact conditional maximum likelihood estimates, exact p-values, and exact confidence intervals for categorical effects in Poisson regression models with an optional offset and stratification. Nuisance parameters (stratum intercepts and other model effects not under test) are eliminated by conditioning on their sufficient statistics rather than relying on asymptotic approximations, which matters when case counts are small or sparse and standard Wald/likelihood-ratio inference is unreliable. Three algorithms are provided for different problem shapes: a fast closed-form method for a single two-level effect with strata as the only nuisance structure, following Guess, Lydick, Small and Miller (1987) <doi:10.1093/oxfordjournals.aje.a114535> and Guess and Thomas (1990) <doi:10.1097/00001648-199001000-00016>; a multivariate shift algorithm for arbitrary categorical covariates and strata, generalizing Hirji, Mehta and Patel (1987) <doi:10.2307/2289388> to bounded Poisson counts; and a network algorithm offering more aggressive mid-computation pruning for larger problems, generalizing Mehta, Patel and Senchaudhuri (1992) <doi:10.1080/10618600.1992.10474574> to bounded Poisson counts.

Authors:Ali Charkhi [aut, cre], Dragoș Moldovan-Grünfeld [ctb], GlaxoSmithKline Research & Development Limited [cph, fnd]

poissonexact_0.1.0.tar.gz
poissonexact_0.1.0.zip(r-4.7-any)poissonexact_0.1.0.zip(r-4.6-any)poissonexact_0.1.0.zip(r-4.5-any)
poissonexact_0.1.0.tgz(r-4.6-any)poissonexact_0.1.0.tgz(r-4.5-any)
poissonexact_0.1.0.tar.gz(r-4.7-any)poissonexact_0.1.0.tar.gz(r-4.6-any)
poissonexact_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
poissonexact/json (API)

# Install 'poissonexact' in R:
install.packages('poissonexact', repos = c('https://dragosmg.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/gsk-biostatistics/poissonexact/issues

Pkgdown/docs site:https://gsk-biostatistics.github.io

On CRAN:

Conda:

3.00 score 4 exports 1 dependencies

Last updated from:8154c779d6. Checks:9 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-develOK214
source / vignettesOK227
linux-releaseOK207
macos-releaseOK247
macos-oldrelOK324
windows-develOK184
windows-releaseOK164
windows-oldrelOK191
wasm-releaseOK82

Exports:ep_closed_formep_multi_shiftep_networkrecompute_exact_inference

Dependencies:rlang

Exact Conditional Poisson Regression: Theory and Implementation
1. Motivation: why exact conditional inference | 2. The model and notation shared by every algorithm | 2.1 Indices and strata | 2.2 Response, offset, exposure | 2.3 Design: the interest column and the nuisance columns | 2.4 The stratified Poisson log-linear model | 2.5 Notation at a glance, and one deliberate disambiguation | 3. The general principle: exponential families and eliminating nuisance parameters by conditioning | 3.1 The model as a canonical exponential family | 3.2 The conditioning theorem | 3.3 Finite conditional reference sets | 3.4 Coefficient tables and the conditional law of $T$ | 4. Adjustment vs. stratification: when they agree, and when they don't | 4.1 The narrow case where the two are the same model | 4.2 The two conditioning events are the same event | 4.3 The general principle: crossing variables into a stratification means adjusting for their full joint interaction (precisely defined) | 4.4 Worked contrast: why fit23 and fit232 disagree | 4.5 Other conditions the equivalence needs | 4.6 Why the package still treats stratification and adjustment as different mechanisms | 4.7 Choosing between stratification and adjustment in practice: a clinical-trials perspective | 5. The multivariate-shift algorithm (ep_multi_shift()) | 5.1 The Poisson base measure, explicitly | 5.2 SAS-style cap rules for $S_i$ | 5.3 Stratum-level decomposition and the within-stratum dynamic program | 5.4 Combining strata (convolution) | 5.5 Pruning for feasibility (Rule A and Rule B) | 5.6 Filtering and marginalizing to $C(t)$ | 5.7 Algorithmic summary: the exact steps performed | 6. The closed-form algorithm (ep_closed_form()) | 6.1 The special case | 6.2 Deriving the within-stratum conditional distribution (Poisson thinning) | 6.3 The coefficient table as a polynomial in $\theta$ | 6.3.1 The Guess-Thomas (1990) recursive algorithm, and why it is fast | 6.4 Correspondence with the general coefficient table | 6.5 Exact inference specifics: the truncated-table trick | 6.6 Why the search over $\beta$ is done the way it is | 6.7 Algorithmic summary: the exact steps performed | 7. The network algorithm (ep_network()) | 7.1 Where this algorithm sits, and why it exists | 7.2 The network representation of a stratum's reference set | 7.3 Backward induction: longest and shortest paths | 7.3.1 Intuition, in plain terms: what "remaining nuisance length" actually means | 7.4 The closed form used by this package, and why it is exact | 7.5 Forward processing with continuous pruning | 7.6 Combining strata | 7.7 Correctness: why the extra pruning never discards a valid state | 8. The shared exact-inference machinery | 8.1 Log-scale arithmetic and log-sum-exp | 8.2 The conditional maximum likelihood estimate (CMLE) | 8.3 Root-finding scaffold | 8.4 P-values and confidence intervals | 9. Numerical implementation notes | 10. Comparing the three algorithms, and choosing among them | 10.1 Why the closed-form algorithm is faster, precisely, in the case it covers | 10.2 A worked example where the algorithms genuinely disagree | 10.3 Multivariate-shift versus network, precisely | 10.4 Practical guidance | 11. References

Last update: 2026-11-09
Started: 2026-11-09

A Low-Incidence Vaccine Efficacy Example
Why this vignette exists | The scenario | Simulating the trial | Recommended: aggregate repeated covariate patterns before fitting | Analysing it the exact way | Analysing the same model with glm() | Side by side | Cross-checking with the general algorithms | Reusing an already-computed exact distribution | A different null hypothesis: is efficacy above 50%, not just above 0%? | A different confidence level: 90% instead of 95% | A Monte Carlo check: does the nominal coverage actually hold? | A more general model: adjusting for a covariate on top of stratification | References

Last update: 2026-11-09
Started: 2026-11-09