NegativeBinomialLS#
- class superglm.NegativeBinomialLS#
Bases:
MeanPredictor,ThetaPredictorNegative-binomial responses with mean and size predictors.
Declare
family.mean(...)andfamily.theta(...). Both use log links. The unit count law has variancemean + mean**2 / theta, so larger theta means less overdispersion.thetais the size parameter in the NB2 parametrization.Results use the column names
meanandthetain that order.family.theta()estimates a constant size; a declaration with terms lets size vary between rows. The observation law for counts or weighted rates follows the model’s weight contract.See also
SuperLSSConstruct and fit a model with these predictors.
- response_boundaries(
- links: Sequence[Link],
All-zero rows drive the mean to 0 or the size to 0 under log links.
P(Y = 0) = (theta / (theta + mu))^thetatends to one aslog mu -> -infand aslog theta -> -inf.
- limit_row_count(
- theta: NDArray,
- plan: FamilyLikelihoodPlan,
The size’s parameter index and how many rows the kernel treats as Poisson.
Rows with
max(mean, count - 1)below2**-52times the size, in effective units. The count informs the disclosure only; the terminal rank decision is the test. A derived family reports no rows.
- limit_row_disclosure( ) str#
Say that the size is not identified, with
n_limitrows at the Poisson limit.constant_offered(seeLimitRowDisclosingFamily) is true when a constant size can be offered and the size has terms to drop; otherwise only the Poisson family is suggested. A derived family gets no text.
- expected_information_natural(
- theta: NDArray,
- plan: FamilyLikelihoodPlan,
Packed natural-scale Fisher information of each row’s mean and size.
- predictor_curvature_directional_derivative(
- y: NDArray,
- eta: NDArray,
- eta_direction: NDArray,
- links: Sequence[Link],
- plan: FamilyLikelihoodPlan,
Differentiate observed predictor curvature along one predictor path.
- certified_predictor_curvature_directional_derivative(
- y: NDArray,
- eta: NDArray,
- eta_direction: NDArray,
- links: Sequence[Link],
- plan: FamilyLikelihoodPlan,
The curvature direction and the certified error of its
l_bbbchannel.
- predictor_curvature_second_directional_derivative(
- y: NDArray,
- eta: NDArray,
- direction_a: NDArray,
- direction_b: NDArray,
- links: Sequence[Link],
- plan: FamilyLikelihoodPlan,
Differentiate observed predictor curvature twice, along
athenb.
- certified_predictor_curvature_second_directional_derivative(
- y: NDArray,
- eta: NDArray,
- direction_a: NDArray,
- direction_b: NDArray,
- links: Sequence[Link],
- plan: FamilyLikelihoodPlan,
- *,
- step: float = 0.001,
The second curvature direction and the bounded error of its
l_bbbbchannel.The series bound does not depend on the derivative
step.
- log_window_probability(
- lower,
- upper,
- theta,
- weights=None,
log P(lower < N/w <= upper); omitted weights mean unit exposure.