comprisk.ROC: calculate ROC curves for competing risk models

Description Usage Arguments Value References See Also Examples

View source: R/comprisk.ROC.R

Description

This function calculates true positive rate (TPR) and false positive rate (FPR) for time to event data when there are potentially two causes of failure (competing risks). These values can be used to plot ROC curves. AUC is also calculated.

Two different ways of defining cases for these data can be accounted for in the analysis (see 'type' variable below).

Usage

1
comprisk.ROC(times, status1, status2, x, Z = NULL, predict.time, type, smooth=FALSE, sigma)

Arguments

times

vector of min(time to event, censoring time) for each individual.

status1

vector of indicators specifying that event 1 was the cause of failure (should equal 1 for individuals where event 1 occured)

status2

vector of indicators specifying that event 2 was the cause of failure (should equal 1 for individuals where event 2 occured)

x

vector of marker values

Z

vector of (discrete) covariate values

predict.time

The prediction time to use to calculate the TPR and FPR. Should be a single numeric value.

type

Can take on two values.

Set type = 1 if case is defined by the event of interest, and controls are all the rest. Set type = 2 if case is defined by stratifying on event type, and controls are those who have not experienced any events.

smooth

TRUE/FALSE (default). When set to TRUE non-parametric smoothing is used instead of Cox proportional hazards model. Note, when smooth = TRUE, Z is ignored. Also, optional tuning parameter sigma may be set when using smooth =TRUE.

sigma

Tuning parameter to be set when smooth = TRUE. The default value of sigma = sd(x)/length(x)^1/3

Value

Returns a list of values

AUC

AUC values under each Z strata. If type = 2, AUC is also given for each event type

ROC

A dataframe consisting of TPR, FPR, and Z values.

If type = 1, the names of the data frame are TPR, FPR and Z.

If type = 2, we stratify on event type, so we have seperate TPR and FPR values for different events. Thus, the names of the data frame are TPR.event1, FPR.event1, TPR.event2, FPR.event2, Z.

See 'references' for more information on type.

References

Zheng Y, Cai T, Jin Y, Feng Z. Evaluating prognostic accuracy of biomarkers under competing risk. Biometrics. 2012 Jun;68(2):388-96.

Zheng Y, Cai T, Feng Z, and Stanford J. Semiparametric Models of Time-dependent Predictive Values of Prognostic Biomarkers. Biometrics. 2010, 66: 50-60.

See Also

comprisk.ROC.CI

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
data(crdata)

## comprisk.ROC
#type 1
myROC.type1 <- comprisk.ROC( times = crdata$times,
                             status1 = crdata$status1, 
                             status2 = crdata$status2, 
                             x = crdata$x, 
                             Z = crdata$Z, 
                             predict.time = 10, 
                             type = 1)
                                                   
myROC.type1

#plot
tmp <- myROC.type1$ROC

plot(tmp$FPR[tmp$Z==0], tmp$TPR[tmp$Z==0], type="l",lwd=2, main="Type 1", xlab="FPR", ylab="TPR")
lines(tmp$FPR[tmp$Z==1], tmp$TPR[tmp$Z==1], lty=2, lwd=2)
legend(x="bottomright", c("Z = 0", "Z = 1"), lty=c(1,2))
lines(c(0, 1), c(0,1), col="lightgrey")


myROC.type2 <- comprisk.ROC( times = crdata$times,
                             status1 = crdata$status1, 
                             status2 = crdata$status2, 
                             x = crdata$x, 
                             Z = crdata$Z, 
                             predict.time = 10, 
                             type = 2)
                                                   
myROC.type2

mdbrown/survCompetingRisk documentation built on May 22, 2019, 3:23 p.m.