getCindex: Compute C index for a Cox model

Description Usage Arguments Value Examples

View source: R/getCindex.R

Description

Computes Harrel's C (concordance) index for predictions, taking censoring into account.

Usage

1
getCindex(pred, y, weights = rep(1, nrow(y)))

Arguments

pred

A vector of predictions.

y

Survival response variable, must be a Surv or stratifySurv object.

weights

Observation weights (default is all equal to 1).

Value

The C index for the predictions (a single numeric value).

Examples

1
2
3
4
set.seed(1)
pred <- rep(1:2, length.out = 10)
y <- survival::Surv(exp(rnorm(10)), rbinom(10, 1, 0.5))
getCindex(pred, y)

cvwrapr documentation built on June 11, 2021, 5:21 p.m.