Skip to contents

Fits a univariate Cox proportional hazards model by maximizing the partial log-likelihood using an Iteratively Reweighted Least Squares (IRLS) approach. Supports both Breslow and Efron approximations for handling ties.

Arguments

x

Numeric vector of length n: covariate values.

y

Numeric matrix with shape n × 2, where:

  • y[,1] is the observed time

  • y[,2] is the event indicator (1 = event, 0 = censored)

offset

Numeric scalar or vector of length n. Optional offset for the linear predictor.

ties

Character string specifying the method to handle ties: "breslow" (default) or "efron".

lambda

Numeric penalty weight; if ≤ 0, defaults to \(\sqrt{2\log(n)/n}\) (default: 0.0).

tau

Numeric truncation parameter; if ≤ 0, defaults to 0.5 (default: 0.5).

max_iter

Integer: maximum number of IRLS iterations. Default is 25.

tol

Numeric: convergence tolerance on parameter change. Default is 1e-8.

Value

A numeric scalar representing the estimated regression coefficient theta.

Details

The function starts from an initial coefficient value of 0 and updates the slope estimate using Newton-Raphson iterations until convergence or until reaching the maximum number of iterations. The linear predictor is lp = offset + theta * x. The score function and observed information are used to update the estimate.

Examples

if (FALSE) { # \dontrun{
x <- c(1, 2, 3, 4)
y <- matrix(c(4,1, 1,1, 3,0, 2,1), ncol = 2, byrow = TRUE)
univariate_irls_cox(x, y, offset = 0, ties = "efron", max_iter = 50, tol = 1e-6)
} # }