roc: ROC curve

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Compute ROC curve

Usage

1
roc(X,etime,status,u=NULL,tt,s,vtimes,fc=NULL)

Arguments

X

n by S matrix of longitudinal score/biomarker for i-th subject at j-th occasion (NA if unmeasured)

etime

n vector with follow-up times

status

n vector with event indicators

u

Lower limit for evaluation of sensitivity and specificity. Defaults to vtimes[s] (see below)

tt

Upper limit (time-horizon) for evaluation of sensitivity and specificity.

s

Scalar number of measurements/visits to use for each subject. s<=S

vtimes

S vector with visit times

fc

Events are defined as fc = 1. Defaults to $I(cup X(t_j)>cutoff)$

Details

ROC curve is defined as the curve given by (1-specificities, sensitivities). Here these are obtained for a time-dependent multiply-measured marker are defined as

Se(t,c,s,u) = Pr(f_c(X(t_1),X(t_2),...,X(t_s_i))| u <= T <= t),

and

Sp(t,c,s,u) = 1-Pr(f_c(X(t_1),X(t_2),...,X(t_s_i)) | T > t)

for some fixed f_c, where c is a cutoff. The default for f_c is that a positive diagnosis is given as soon as any measurement among the s considered is above the threshold.

Value

A matrix with the following columns:

1-spec 1-Specificities
sens Sensitivities

Author(s)

Alessio Farcomeni alessio.farcomeni@uniroma1.it

References

Barbati, G. and Farcomeni, A. (2017) Prognostic assessment of repeatedly measured time-dependent biomarkers, with application to dilated cardiomuopathy, Statistical Methods \& Applications, in press

See Also

auc, butstrap, maxauc

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
# parameters
n=100
tt=3
Tmax=10
u=1.5
s=2
vtimes=c(0,1,2,5)

# generate data 

ngrid=5000
ts=seq(0,Tmax,length=ngrid)
X2=matrix(rnorm(n*ngrid,0,0.1),n,ngrid)
for(i in 1:n) {
sa=sample(ngrid/6,1)
vals=sample(3,1)-1
X2[i,1:sa[1]]=vals[1]+X2[i,1:sa[1]]
X2[i,(sa[1]+1):ngrid]=vals[1]+sample(c(-2,2),1)+X2[i,(sa[1]+1):ngrid]
}

S1=matrix(sample(4,n,replace=TRUE),n,length(vtimes))
S2=matrix(NA,n,length(vtimes))

S2[,1]=X2[,1]

for(j in 2:length(vtimes)) {
tm=which.min(abs(ts-vtimes[j]))
S2[,j]=X2[,tm]}

cens=runif(n)
ripart=1-exp(-0.01*apply(exp(X2),1,cumsum)*ts/1:ngrid)

Ti=rep(NA,n)
for(i in 1:n) {
Ti[i]=ts[which.min(abs(ripart[,i]-cens[i]))]
}

cens=runif(n,0,Tmax*2)
delta=ifelse(cens>Ti,1,0)
Ti[cens<Ti]=cens[cens<Ti]

## 

## an important marker 

ro=roc(S2,Ti,delta,u,tt,s,vtimes) 
plot(ro,type="l",col="red")
abline(a=0,b=1)

## an unrelated marker 

ro=roc(S1,Ti,delta,u,tt,s,vtimes) 
plot(ro,type="l",col="red")
abline(a=0,b=1)

longROC documentation built on May 2, 2019, 12:40 p.m.

Related to roc in longROC...