comprisk.PPV.CI: calculate bootstrap CI's for PPV curves under competing risk...

Description Usage Arguments Value References See Also Examples

View source: R/comprisk.PPV.CI.R

Description

This function calculates bootstrap confidence intervals for either the positive prediction value (PPV) or the negative prediction value (NPV) for time to event data when there are potentially two causes of failure (competing risks). The user is able to fix one of PPV, NPV or v = marker quantile. Confidence bands for the non-fixed variables are then derived from the empirical bootstrap distribution at the values given by "fixed.values".

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

Usage

1
comprisk.PPV.CI(times, status1, status2, x, Z = NULL, predict.time, type, smooth = FALSE, fixed.values = 1:20/20, fixed = "v", alpha = 0.05, bootstraps = 500, 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 PPV and NPV. 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.

See 'references' for more information on type.

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.

fixed.values

vector of values to obtain confidence bounds. Default is fixed.values = 1:20/20.

fixed

Which quantity to fix. Must be one of "v", "PPV", or "NPV". Default is fixed = "v", so that confidence bands for PPV and NPV, at fixed values of FPR, are output.

alpha

(1-alpha)% CI's are returned. Default is alpha = .05 (95% CI's given).

bootstraps

number of bootstraps to use to obtain CI's. Default is set to 500.

sigma

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

Value

A dataframe with the following values: Z, fixed values, lower bound CI 1, upper bound CI 1, lower bound CI 2, upper bound CI 2. The user is able to fix one of PPV, NPV, or v (= marker quantile), so confidence bounds are given for the other (non-fixed) variables. For example, if v is fixed, confidence bounds for NPV and PPV will be provided. The columns are automatically named to aviod confusion.

If type = 1, only one set of confidence intervals are given for each varying measure. If type = 2, we stratify on event type, and so confidence intervals are given for both event 1 and for event 2 and for each varying measure.

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.PPV

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
data(crdata)

## comprisk.PPV.CI
#type 1

myPPV.type1.CI <- comprisk.PPV.CI( times = crdata$times, 
                                status1 = crdata$status1, 
                                status2 = crdata$status2, 
                                x = crdata$x, 
                                Z = crdata$Z, 
                                predict.time = 10, 
                                type = 1, 
                                fixed.values = c(.05, .45, .6), 
                                fixed = "v", ## one could also set this as "PPV" or "NPV"
                                alpha = .05, 
                                bootstraps = 100) 

myPPV.type1.CI


myPPV.type1 <- comprisk.PPV( times = crdata$times,
                             status1 = crdata$status1, 
                             status2 = crdata$status2, 
                             x = crdata$x, 
                             Z = crdata$Z, 
                             predict.time = 10, 
                             type = 1)
                                                   
head(myPPV.type1)


#plot

tmp <- myPPV.type1

par(mfrow=c(1,1))
plot(tmp$v[tmp$Z==0], tmp$PPV[tmp$Z==0], type="l",lwd=2, main="Type 1", xlab="v", ylab="PPV", ylim=c(0,1))
lines(tmp$v[tmp$Z==1], tmp$PPV[tmp$Z==1], lty=2, lwd=2)
legend(x="bottomright", c("Z = 0", "Z = 1"), lty=c(1,2))

#add horizontal lines at P( T < predict.time, experienced event of interest | Z)
abline( h = min(tmp$PPV[tmp$Z==1]), lty = 2, lwd = 2)
abline( h = min(tmp$PPV[tmp$Z==0]), lty = 1, lwd = 2)



#add CI's to plot
tmp.CI <- myPPV.type1.CI

for( i in 1:nrow(myPPV.type1.CI)){
#offset the confidence intervals by .005 for Z=0 and Z=1, so we can tell the CI's apart on the plot
  lines(x=rep(tmp.CI$fixed_v[i],2) + ifelse(tmp.CI$Z[i]==0, -0.005, .005), y=c(tmp.CI$PPV_0.025[i], tmp.CI$PPV_0.975[i]), lty=ifelse(tmp.CI$Z[i]==0, 1, 2), lwd=1.5)
  
  points(x=rep(tmp.CI$fixed_v[i],2)+ifelse(tmp.CI$Z[i]==0, -.005, .005), y=c(tmp.CI$PPV_0.025[i], tmp.CI$PPV_0.975[i]), pch="-", cex=1.5)
}


 myPPV.type2.CI <- comprisk.PPV.CI( times = crdata$times, 
                                status1 = crdata$status1, 
                                status2 = crdata$status2, 
                                x = crdata$x, 
                                Z = crdata$Z, 
                                predict.time = 10, 
                                type = 2, 
                                fixed.values = c(.05, .45, .6), 
                                fixed = "v", ## one could also set this as PPV or NPV
                                alpha = .05, 
                                bootstraps = 100) 

myPPV.type2.CI

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