<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Bootstrapping AUC</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>

<table width="100%" summary="page for butstrap.s"><tr><td>butstrap.s</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>Bootstrapping AUC</h2>

<h3>Description</h3>

<p>Boostrap the AUC for significance testing and confidence
interval calculation</p>


<h3>Usage</h3>

<pre>
butstrap.s(X,etime,status,u=NULL,tt,s,vtimes,auc1,B=50,fc=NULL)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>X</code></td>
<td>
<p>n by S matrix of longitudinal score/biomarker for i-th
subject at j-th occasion (NA if unmeasured)</p>
</td></tr>
<tr valign="top"><td><code>etime</code></td>
<td>
<p>n vector with follow-up times</p>
</td></tr>
<tr valign="top"><td><code>status</code></td>
<td>
<p>n vector with event indicators</p>
</td></tr>
<tr valign="top"><td><code>u</code></td>
<td>
<p>Lower limit for evaluation of sensitivity and
specificity. Defaults to <code>max(vtimes[s])</code> (see below)</p>
</td></tr>
<tr valign="top"><td><code>tt</code></td>
<td>
<p>Upper limit (time-horizon) for evaluation of sensitivity
and specificity.</p>
</td></tr>
<tr valign="top"><td><code>s</code></td>
<td>
<p>n vector of number of measurements/visits to use for each subject. all(s&lt;=S)</p>
</td></tr>
<tr valign="top"><td><code>vtimes</code></td>
<td>
<p>S vector with visit times</p>
</td></tr>
<tr valign="top"><td><code>auc1</code></td>
<td>
<p>AUC for the original data set</p>
</td></tr>
<tr valign="top"><td><code>B</code></td>
<td>
<p>Number of bootstrap replicates. Defaults to <code>50</code></p>
</td></tr>
<tr valign="top"><td><code>fc</code></td>
<td>
<p>Events are defined as fc = 1. Defaults to $I(cup X(t_j)&gt;cutoff)$</p>
</td></tr>
</table>


<h3>Details</h3>

<p>This function can be used to resample the AUC. The resulting p-value
is obtained after assumption that the resampled AUC is
Gaussian. Non-parametric confidence interval is obtained as the 2.5
and 97.5
confidence interval is simply given by a Gaussian approximation.  
</p>


<h3>Value</h3>

<p>A list with the following elements: 
</p>

<table summary="Rd table">
<tr>
 <td style="text-align: left;">
 	<code>p.value</code> </td><td style="text-align: left;"> (Parametric) p-value for H0: AUC=0.5 </td>
</tr>
<tr>
 <td style="text-align: left;">
	<code>se</code> </td><td style="text-align: left;"> Standard deviation of the AUC replicates  </td>
</tr>
<tr>
 <td style="text-align: left;">
	<code>ci.np</code> </td><td style="text-align: left;"> Non-parametric 95% confidence interval for AUC  </td>
</tr>
<tr>
 <td style="text-align: left;">
	<code>ci.par</code> </td><td style="text-align: left;"> Parametric 95% confidence interval for AUC  </td>
</tr>
<tr>
 <td style="text-align: left;">
	</td>
</tr>

</table>



<h3>Author(s)</h3>

<p>Alessio Farcomeni <a href="mailto:alessio.farcomeni@uniroma1.it">alessio.farcomeni@uniroma1.it</a></p>


<h3>References</h3>

<p>Barbati, G. and Farcomeni, A. (2017) Prognostic assessment of
repeatedly measured time-dependent biomarkers, with application to
dilated cardiomuopathy, <em>Statistical Methods \&amp; Applications</em>, in
press 
</p>


<h3>See Also</h3>

<p><cite>roc</cite>, <cite>auc</cite>, <cite>maxauc</cite>
</p>


<h3>Examples</h3>

<pre>
# parameters
n=100
tt=3
Tmax=10
u=1.5
s=sample(3,n,replace=TRUE)
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&gt;Ti,1,0)
Ti[cens&lt;Ti]=cens[cens&lt;Ti]

## an unimportant marker 

ro=roc.s(S1,Ti,delta,u,tt,s,vtimes) 
but=butstrap.s(S1,Ti,delta,u,tt,s,vtimes,ro)

</pre>


</body></html>
