% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cox_helpers.R
\name{cox_glm_weight_function}
\alias{cox_glm_weight_function}
\title{Cox PH GLM Weight Function}
\usage{
cox_glm_weight_function(
  mu,
  y,
  order_indices,
  family,
  dispersion,
  observation_weights,
  status
)
}
\arguments{
\item{mu}{Predicted values (exp(eta), i.e., relative hazard).}

\item{y}{Observed survival times.}

\item{order_indices}{Observation indices in partition order.}

\item{family}{Cox family object (unused, for interface compatibility).}

\item{dispersion}{Dispersion parameter (fixed at 1 for Cox PH).}

\item{observation_weights}{Observation weights.}

\item{status}{Event indicator (1 = event, 0 = censored).}
}
\value{
Numeric vector of working weights, length N.
}
\description{
Computes working weights for the Cox PH information matrix, used by
lgspline when updating \eqn{\mathbf{G}} after obtaining constrained
estimates. The weights are a diagonal approximation built from the Breslow
tied-event information contributions.
}
\details{
For a tied event-time block \eqn{g}, the diagonal approximation uses
\deqn{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 \eqn{h_j = w_j \exp(\eta_j)},
\eqn{S_g = \sum_{k \in R_g} h_k}, and
\eqn{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.
}
\examples{
## Used internally by lgspline; see cox_helpers examples below.

}
