% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/negbin_helpers.R
\name{negbin_glm_weight_function}
\alias{negbin_glm_weight_function}
\title{NB GLM Weight Function}
\usage{
negbin_glm_weight_function(
  mu,
  y,
  order_indices,
  family,
  dispersion,
  observation_weights
)
}
\arguments{
\item{mu}{Predicted values \eqn{\exp(\eta)}.}

\item{y}{Observed counts.}

\item{order_indices}{Observation indices in partition order.}

\item{family}{NB family object (unused, for interface compatibility).}

\item{dispersion}{Shape parameter \eqn{\theta}.}

\item{observation_weights}{Observation weights.}
}
\value{
Numeric vector of working weights, length N.
}
\description{
Computes working weights for the NB2 information matrix used by
lgspline when updating \eqn{\mathbf{G}} after obtaining constrained
estimates.
}
\details{
The IRLS weight for NB2 with log link is
\deqn{W_i = w_i \mu_i \theta / (\theta + \mu_i)}

Falls back to observation weights when natural weights are degenerate.
}
