cox_qp_score_function: Cox PH Score Function for Quadratic Programming and Blockfit

View source: R/cox_helpers.R

cox_qp_score_functionR Documentation

Cox PH Score Function for Quadratic Programming and Blockfit

Description

Computes the score (gradient of partial log-likelihood) in the format expected by lgspline's qp_score_function interface. The block- diagonal design matrix \mathbf{X} and response \mathbf{y} are in partition order; this function internally sorts by event time, computes the Cox score using the Breslow approximation for tied event times, and returns the result in the original partition order.

Usage

cox_qp_score_function(
  X,
  y,
  mu,
  order_list,
  dispersion,
  VhalfInv,
  observation_weights,
  status
)

Arguments

X

Block-diagonal design matrix (N x P).

y

Response vector (survival times, N x 1).

mu

Predicted values (N x 1), same order as X and y.

order_list

List of observation indices per partition.

dispersion

Dispersion (fixed at 1).

VhalfInv

Inverse square root correlation matrix (NULL for independent observations).

observation_weights

Observation weights.

status

Event indicator (1 = event, 0 = censored).

Value

Numeric column vector of length P (gradient w.r.t. coefficients).


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