View source: R/cal_surv_prob.R
| loss_fn | R Documentation |
Computes the stratified Cox partial log-likelihood for given covariates, event indicators, times, and coefficients.
loss_fn(z, delta, time, stratum, beta)
z |
A numeric matrix (or data frame coercible to matrix) of covariates. Each row is an observation and each column a predictor. |
delta |
A numeric vector of event indicators (1 = event, 0 = censored). |
time |
A numeric vector of observed times (event or censoring). |
stratum |
An optional vector specifying the stratum for each observation (factor/character/numeric). If missing, a single-stratum model is assumed. |
beta |
A numeric vector of regression coefficients with length equal to
the number of columns in |
Inputs are internally sorted by stratum and time. The function
evaluates the stratified Cox partial log-likelihood using the supplied z,
delta, beta, and the stratum sizes.
A single numeric value giving the stratified Cox partial log-likelihood.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.