unconstrained_fit_cox: Unconstrained Cox PH Estimation for lgspline

View source: R/cox_helpers.R

unconstrained_fit_coxR Documentation

Unconstrained Cox PH Estimation for lgspline

Description

Estimates penalized Cox PH coefficients for a single partition (or the full model when K = 0) using damped Newton-Raphson on the penalized partial log-likelihood with the Breslow approximation for tied event times.

This function is passed to lgspline's unconstrained_fit_fxn argument. It receives the partition-level design matrix and response, sorts internally by event time, and returns the coefficient vector.

Usage

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

Arguments

X

Design matrix (N_k x p) for partition k.

y

Survival times for partition k.

LambdaHalf

Square root of penalty matrix (unused here, retained for interface compatibility).

Lambda

Penalty matrix.

keep_weighted_Lambda

Logical; if TRUE, return hot-start estimates without refinement (not recommended for Cox).

family

Cox 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.

status

Event indicator (1 = event, 0 = censored), full-data length.

Details

The penalized partial log-likelihood is

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

Newton-Raphson updates use the Cox score and observed information (computed via score_cox and info_cox), plus the penalty term. The step is damped: the step size is halved until the penalized log-likelihood improves.

Value

Numeric column vector of penalized partial-likelihood coefficient estimates.

Examples

## Used internally by lgspline; see the full-model example below.


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