This function creates risksetAUC from a survival data set
1 2 3 4 
Stime 
For right censored data, this is the follow up time. For left truncated data, this is the ending time for the interval. 
entry 
For left truncated data, this is the entry time of the interval. The default is set to NULL for right censored data. 
status 
survival status, 1 if had an event and 0 otherwise 
marker 
marker 
method 
either of "Cox", "LocalCox" and "Schoenfeld", default is "Cox" 
span 
bandwidth parameter that controls the size of a local neighborhood, needed for method="LocalCox" or method="Schoenfeld" 
order 
0 or 1, locally mean if 0 and local linear if 1, needed for method="Schoenfeld", default is 1 
window 
either of "asymmetric" or "symmetric", default is asymmetric, needed for method="LocalCox" 
tmax 
maximum time to be considered for calculation of AUC 
weight 
either of "rescale" or "conditional". If weight="rescale", then weights are rescaled so that the sum is unity. If weight="conditional" both the event times are assumed to be less than tmax 
plot 
TRUE or FALSE, default is TRUE 
type 
default is "l", can be either of "p" for points, "l" for line, "b" for both 
xlab 
label for xaxis 
ylab 
label for yaxis 
... 
additional plot arguments 
This function creates and plots AUC based on incident/dynamic definition of Heagerty, et. al. based on a survival data and marker values. If proportional hazard is assumed then method="Cox" can be used. In case of nonproportional hazard, either of "LocalCox" or "Schoenfeld" can be used. These two methods differ in how the smoothing is done. If plot="TRUE" then the AUC curve is plotted against time (till tmax+1). Additional plot arguments can be supplied.
Returns a list of the following items:
utimes 
ordered unique failure times 
St 
estimated survival probability at utimes 
AUC 
Area under ROC curve at utimes 
Cindex 
Cindex 
Paramita Saha
Heagerty, P.J., Zheng Y. (2005) Survival Model Predictive Accuracy and ROC curves Biometrics, 61, 92 – 105
IntegrateAUC(), weightedKM(), llCoxReg(), SchoenSmooth(), CoxWeights()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  library(MASS)
data(VA)
survival.time=VA$stime
survival.status=VA$status
score < VA$Karn
cell.type < factor(VA$cell)
tx < as.integer( VA$treat==1 )
age < VA$age
survival.status[survival.time>500 ] < 0
survival.time[survival.time>500 ] < 500
fit0 < coxph( Surv(survival.time,survival.status)
~ score + cell.type + tx + age, na.action=na.omit )
eta < fit0$linear.predictor
tmax=365
AUC.CC=risksetAUC(Stime=survival.time,
status=survival.status, marker=eta, method="Cox", tmax=tmax);

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.