cox_glm_weight_function: Cox PH GLM Weight Function

View source: R/cox_helpers.R

cox_glm_weight_functionR Documentation

Cox PH GLM Weight Function

Description

Computes working weights for the Cox PH information matrix, used by lgspline when updating \mathbf{G} after obtaining constrained estimates. The weights are a diagonal approximation built from the Breslow tied-event information contributions.

Usage

cox_glm_weight_function(
  mu,
  y,
  order_indices,
  family,
  dispersion,
  observation_weights,
  status
)

Arguments

mu

Predicted values (exp(eta), i.e., relative hazard).

y

Observed survival times.

order_indices

Observation indices in partition order.

family

Cox family object (unused, for interface compatibility).

dispersion

Dispersion parameter (fixed at 1 for Cox PH).

observation_weights

Observation weights.

status

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

Details

For a tied event-time block g, the diagonal approximation uses

W_{jj}^{(g)} = d_g^{(w)} \frac{h_j}{S_g} \Bigl(1 - \frac{h_j}{S_g}\Bigr), \qquad j \in R_g

where h_j = w_j \exp(\eta_j), S_g = \sum_{k \in R_g} h_k, and d_g^{(w)} = \sum_{i \in D_g} w_i.

When the natural weights are degenerate (all zero or non-finite), falls back to a vector of ones.

Value

Numeric vector of working weights, length N.

Examples

## Used internally by lgspline; see cox_helpers examples below.


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