Count outcomes

Conditional and marginal Poisson methods. Observation-time options differ by method.

fit_poisson(y, exposures, covariates=None, *, q=4, breaks=None, alpha=0.05, weights=None, exposure_time=None)

Fit an additive Poisson-log model and sum exposure coefficients.

y must contain nonnegative integer counts. Inputs are complete, real and finite. Supply positive exposure_time for unequal periods. Positive case weights act as GLM prior weights. Exposure cuts ignore weights. The sum is a conditional log rate ratio. Its confidence interval uses normal limits and a normal z p-value, following R qgcomp 2.19.6.

fit_poisson_formula(formula, data, exposures, *, q=4, breaks=None, alpha=0.05, missing='raise', weights=None, exposure_time=None)

Fit additive Poisson-log main effects from named columns.

missing='drop' removes incomplete rows after estimating automatic exposure cutpoints from all observed exposure values, as in R qgcomp.

fit_poisson_bootstrap(y, exposures, covariates=None, *, q=4, breaks=None, alpha=0.05, B=200, seed=None, exposure_time=None)

Estimate marginal Poisson mean ratios with fixed-cut row resampling.

Accepts complete numeric rows, optional positive observation times, no case weights, and independent rows. Each row's observation time remains fixed under every intervention and follows that row during resampling. A failed draw is reported, not replaced.

fit_poisson_ee(y, exposures, cluster_ids, covariates=None, *, q=4, breaks=None, alpha=0.05, weights=None, exposure_time=None)

Fit an additive Poisson-log marginal curve with a cluster sandwich.

Inputs must be complete numeric rows, nonnegative integer counts and exact integer cluster IDs. Positive weights affect both estimating equations and cluster scores but not exposure cuts. Positive exposure_time supplies a log offset for unequal observation periods, held fixed under interventions. Nonlinear terms and lag structures are outside this subset.