negbin_glm_weight_function: NB GLM Weight Function

View source: R/negbin_helpers.R

negbin_glm_weight_functionR Documentation

NB GLM Weight Function

Description

Computes working weights for the NB2 information matrix used by lgspline when updating \mathbf{G} after obtaining constrained estimates.

Usage

negbin_glm_weight_function(
  mu,
  y,
  order_indices,
  family,
  dispersion,
  observation_weights
)

Arguments

mu

Predicted values \exp(\eta).

y

Observed counts.

order_indices

Observation indices in partition order.

family

NB family object (unused, for interface compatibility).

dispersion

Shape parameter \theta.

observation_weights

Observation weights.

Details

The IRLS weight for NB2 with log link is

W_i = w_i \mu_i \theta / (\theta + \mu_i)

Falls back to observation weights when natural weights are degenerate.

Value

Numeric vector of working weights, length N.


lgspline documentation built on May 8, 2026, 5:07 p.m.