negbin_theta: Estimate Negative Binomial Shape Parameter

View source: R/negbin_helpers.R

negbin_thetaR Documentation

Estimate Negative Binomial Shape Parameter

Description

Computes the profile MLE of the shape parameter \theta given current mean estimates \mu.

Usage

negbin_theta(y, mu, weights = 1, init = NULL)

Arguments

y

Response vector.

mu

Mean vector.

weights

Observation weights (default 1).

init

Optional initial value for \theta. If NULL, uses a moment-based estimate.

Details

Maximizes the profile log-likelihood over \theta via Brent's method on [10^{-4}, 10^4].

Value

Scalar MLE of \theta.

Examples

set.seed(1234)
mu <- rep(5, 200)
y <- rnbinom(200, size = 3, mu = 5)
negbin_theta(y, mu)


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