poissonexact

Exact conditional inference for Poisson regression: 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. This matters when case counts are small or sparse and standard Wald/likelihood-ratio inference is unreliable (rare outcomes, small strata, vaccine/drug-safety signal detection, and similar settings).

Three algorithms are provided for different problem shapes:

recompute_exact_inference() lets a caller ask a different question (a different null, significance level, or CI type/direction) about an already-fitted result’s OUTDIST table without rebuilding it.

The conditioning approach mirrors that used by SAS’s PROC GENMOD EXACT statement; users familiar with that procedure’s options and output will find the terminology (EXACTMAX, OFFSET, OUTDIST) intentionally similar.

Installation

Install the released version of {poissonexact} from CRAN:

install.packages("poissonexact")

Or install the development version from GitHub with:

# install.packages("pak")
pak::pak("GSK-Biostatistics/poissonexact")

A minimal example

A two-arm, single-stratum comparison (the simplest case ep_closed_form() is built for):

library(poissonexact)

df <- data.frame(
  group = c("treatment", "control"),
  cases = c(2, 8),
  person_time = c(100, 100)
)

fit <- ep_closed_form(
  formula = cases ~ group,
  data = df,
  offset = "person_time",
  offset_log = FALSE,
  ref_levels = list(group = "control"),
  verbose = FALSE
)
fit$exactparmest

See vignette("Theory-Implementation") for the full statistical derivation and vignette("Example") for a realistic, stratified worked example (including a Monte Carlo check of empirical coverage against the usual asymptotic Wald approach).