Learn R Programming

discSurv (version 2.0.0)

cIndexCompRisks: Discrete concordance index for competing risks

Description

Estimates the discrete concordance index in the case of competing risks.

Usage

cIndexCompRisks(markers, testTime, testEvents, trainTime, trainEvents)

Arguments

markers

Predictions on the test data with model fitted on training data ("numeric matrix"). Predictions are stored in the rows and the number of columns equal to the number of events.

testTime

New time intervals in the test data ("integer vector").

testEvents

New event indicators (0 or 1) in the test data ("binary matrix"). Number of columns are equal to the number of events.

trainTime

Time intervals in the training data ("integer vector").

trainEvents

Event indicators (0 or 1) in the training data ("binary matrix"). Number of columns are equal to the number of events.

Value

Value of discrete concordance index between zero and one ("numeric vector").

References

heyardValCompRisksdiscSurv

See Also

cIndex

Examples

Run this code
# NOT RUN {
##################################################
# Example with unemployment data and prior fitting

library(Ecdat)
data(UnempDur)
summary(UnempDur$spell)
# Extract subset of data
set.seed(635)
IDsample <- sample(1:dim(UnempDur)[1], 100)
UnempDurSubset <- UnempDur [IDsample, ]
set.seed(-570)
TrainingSample <- sample(1:100, 75)
UnempDurSubsetTrain <- UnempDurSubset [TrainingSample, ]
UnempDurSubsetTest <- UnempDurSubset [-TrainingSample, ]

# Convert to long format
UnempDurSubsetTrainLong <- dataLongCompRisks(dataShort = UnempDurSubsetTrain, timeColumn = "spell", 
eventColumns = c("censor1", "censor4"), timeAsFactor = TRUE)

# Estimate continuation ratio model with logit link
vglmFit <- VGAM::vglm(formula = cbind(e0, e1, e2) ~ timeInt + age + logwage, 
data = UnempDurSubsetTrainLong, family=VGAM::multinomial(refLevel = "e0"))

gamFitPreds <- VGAM::predictvglm(vglmFit , newdata = cbind(UnempDurSubsetTest, 
timeInt = as.factor(UnempDurSubsetTest$spell)))

# Evaluate C-Index based on short data format
cIndexCompRisks(markers = gamFitPreds, 
testTime = UnempDurSubsetTest$spell, 
testEvents = UnempDurSubsetTest[, c("censor1", "censor4")], 
trainTime = UnempDurSubsetTrain$spell, 
trainEvents = UnempDurSubsetTrain[, c("censor1", "censor4")])

# }

Run the code above in your browser using DataLab