Skip to contents

Computes the partial log-likelihood for a univariate Cox proportional hazards model. Handles ties using either the Breslow or Efron approximation.

Arguments

x

Numeric vector of length n: covariate values for each individual.

y

Numeric matrix of shape n × 2, where: - y[,1] contains event/censoring times - y[,2] contains event status (1 = event, 0 = censored)

theta

Numeric scalar: the coefficient to evaluate the log-likelihood at.

offset

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

ties

Character string: tie-handling method. Must be either "breslow" or "efron".

Value

Numeric scalar: the partial log-likelihood value.

Details

The function computes the linear predictor as: lp = offset + theta * x. The partial log-likelihood is calculated using either the Breslow or Efron method for handling tied event times.

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_loglik_cox(x, y, offset = 0, theta = 0.5, ties = "efron")
} # }