unconstrained_fit_negbin: Unconstrained NB Estimation for lgspline

View source: R/negbin_helpers.R

unconstrained_fit_negbinR Documentation

Unconstrained NB Estimation for lgspline

Description

Estimates penalized NB2 coefficients for a single partition (or the full model when K = 0) using a two-stage optimization: outer loop profiles over \theta via Brent's method, inner loop estimates \boldsymbol{\beta} via damped Newton-Raphson on the penalized log-likelihood.

Usage

unconstrained_fit_negbin(
  X,
  y,
  LambdaHalf,
  Lambda,
  keep_weighted_Lambda,
  family,
  tol = 1e-08,
  K,
  parallel,
  cl,
  chunk_size,
  num_chunks,
  rem_chunks,
  order_indices,
  weights
)

Arguments

X

Design matrix (N_k x p) for partition k.

y

Response counts for partition k.

LambdaHalf

Square root of penalty matrix.

Lambda

Penalty matrix.

keep_weighted_Lambda

Logical; if TRUE, return hot-start estimates from augmented Poisson regression without refinement.

family

NB family object.

tol

Convergence tolerance.

K

Number of knots.

parallel

Logical for parallel processing.

cl

Cluster object.

chunk_size

num_chunks, rem_chunks Parallelism parameters.

order_indices

Observation indices mapping partition to full data.

weights

Observation weights.

Details

The penalized log-likelihood is

\ell_p(\boldsymbol{\beta}, \theta) = \ell(\boldsymbol{\beta}, \theta) - \tfrac{1}{2}\boldsymbol{\beta}^{\top} \boldsymbol{\Lambda}\boldsymbol{\beta}

The outer loop optimizes \theta given the inner-loop-optimal \boldsymbol{\beta}(\theta). This mirrors the Weibull AFT approach where scale (\sigma) is profiled out.

Initialization uses Poisson regression coefficients as a hot start (equivalent to \theta \to \infty).

Value

Numeric column vector of penalized coefficient estimates.


lgspline documentation built on Aug. 5, 2026, 1:10 a.m.