Code
from _api_doc_utils import *Poisson GLM for count outcomes
Group: Regression
Poisson fits
\[ \mathbb E[Y_i\mid X_i=x_i]=\exp(\alpha+x_i'\beta). \]
The alpha constructor argument is an L2 penalty, not the intercept. For alpha=0, summary(vcov='vanilla') reports Fisher-information standard errors and summary(vcov='sandwich') reports robust QMLE-style standard errors. Penalized fits mark inference unavailable and omit se/vcov.
Constructor: cm.Poisson
Use fit(x, y) with nonnegative count-like outcomes. predict(x) returns fitted conditional means. The class also supports bootstrap(B, seed=None).
rng = np.random.default_rng(7)
x = rng.normal(size=(250, 2))
mu = np.exp(0.2 + x @ np.array([0.4, -0.25]))
y = rng.poisson(mu).astype(float)
model = cm.Poisson(max_iterations=200, tolerance=1e-08)
model.fit(x, y)
print(model.summary(vcov='vanilla')['coef'])
print(model.summary(vcov='sandwich')['coef_se'])
print(model.predict(x[:3]))summary() contractThe table below is generated by fitting the live class in this repository and then inspecting summary(). Shapes are shown because most values are plain NumPy arrays or scalars.