Learn R Programming

dynpred (version 0.1.2)

CVcindex: Calculate cross-validated c-index

Description

This function calculates cross-validated versions of Harrell's c-index.

Usage

CVcindex(formula, data, type = "single", matrix = FALSE)

Arguments

formula
Formula for prediction model to be used as in coxph
data
Data set in which to interpret the formula
type
One of "single", "pair" or "fullpairs". For "single" (default), the prognostic index Z_i is replaced by Z_i,(-i), for "pair", two assessments of concordance are made for each pair (i,j), one using Z_i,(-i) and Z_j,(-i), the other using Z_i,(-j) and Z_j,(-j), for "fullpairs", each of the possible pairs is left out and comparison is based on Z_i,(-i,-j) and Z_j,(-i,-j)
matrix
if TRUE, the matrix of cross-validated prognostic indices is also returned; default is FALSE

Value

A list with elements
concordant
The number of concordant pairs
total
The total number of pairs that can be evaluated
cindex
The cross-validated c-index
matrix
Matrix of cross-validated prognostic indices (only if argument matrix is TRUE
and with attribute "type" as given as input.

References

Harrell FE, Lee KL & Mark DB (1996), Multivariable prognostic models: issues in developing models, evaluating assumptions and adequacy, and measuring and reducing errors, Statistics in Medicine 15, 361-387.

van Houwelingen HC, Putter H (2012). Dynamic Prediction in Clinical Survival Analysis. Chapman & Hall.

Examples

Run this code
data(ova)
# Real thing takes a long time, so on a smaller data set
ova2 <- ova[1:100,]
# Actual c-index
cindex(Surv(tyears,d) ~ Karn + Broders + FIGO + Ascites + Diam, data = ova2)
# Cross-validated c-indices
CVcindex(Surv(tyears,d) ~ Karn + Broders + FIGO + Ascites + Diam, data = ova2)
CVcindex(Surv(tyears,d) ~ Karn + Broders + FIGO + Ascites + Diam, data = ova2,
         type="pair")

CVcindex(Surv(tyears,d) ~ Karn + Broders + FIGO + Ascites + Diam, data = ova2,
         type="fullpairs")

Run the code above in your browser using DataLab