R package for estimating the hazard discrimination summary (HDS). HDS is a measure of time-varying prognostic performance. It can be thought of as an incident, time-varying extension of the discrimination slope (Yates 1982), which is perhaps better known as an important part of the integrated discrimination improvement (IDI; Pencina et al. 2008). Alternatively, HDS is a risk-based complement to the incident/dynamic time-dependent AUC (Heagerty and Zheng 2005). Under some circumstances, HDS also has interesting connections to the Cox model partial likelihood. For a detailed overview of HDS, see Liang and Heagerty (2016) and the related discussions and rejoinder.

To install through CRAN, use

```
install.packages("hds")
```

To install the latest (though not necessarily stable) GitHub version, make sure you have `devtools`

installed and use

```
devtools::install_github("liangcj/hds")
```

A simple example using the Mayo PBC data from the `survival`

package demonstrating both `hds`

(estimator based on the Cox model) and `hdslc`

(more flexible estimator based on the local-in-time Cox model):

```
head(hds(times = survival::pbc[1:312, 2],
status = (survival::pbc[1:312, 3]==2)*1,
m = survival::pbc[1:312, 5]))
hdsres <- hds(times=pbc5[,1], status=pbc5[,2], m=pbc5[,3:7])
hdslcres <- hdslc(times = pbc5[,1], status=pbc5[,2], m = pbc5[,3:7], h = 730)
Survt <- summary(survival::survfit(survival::Surv(pbc5[,1], pbc5[,2])~1))
Survtd <- cbind(Survt$time, c(0,diff(1-Survt$surv)))
tden <- density(x=Survtd[,1], weights=Survtd[,2], bw=100, kernel="epanechnikov")
par(mar=c(2.25,2.25,0,0)+0.1, mgp=c(1.25,0.5,0))
plot(c(hdslcres[,1], hdslcres[,1]), c(hdslcres[,2] - 1.96*hdslcres[,3],
hdslcres[,2] + 1.96*hdslcres[,3]),
type="n", xlab="days", ylab="HDS(t)", cex.lab=.75, cex.axis=.75,
ylim=c(-3,15), xlim=c(0,3650))
polygon(x=c(hdsres[,1], hdsres[312:1,1]), col=rgb(1,0,0,.25), border=NA,
fillOddEven=TRUE, y=c(hdsres[,2]+1.96*hdsres[,3],
(hdsres[,2]-1.96*hdsres[,3])[312:1]))
polygon(x=c(hdslcres[,1], hdslcres[312:1, 1]), col=rgb(0,0,1,.25), border=NA,
fillOddEven=TRUE, y=c(hdslcres[,2] + 1.96*hdslcres[,3],
(hdslcres[,2] - 1.96*hdslcres[,3])[312:1]))
lines(hdsres[,1], hdsres[,2], lwd=2, col="red")
lines(hdslcres[,1], hdslcres[,2], lwd=2, col="blue")
abline(h=1, lty=3)
legend(x=1200, y=14, legend=c("Proportional hazards",
"Local-in-time proportional hazards",
"Time density"), col=c("red", "blue", "gray"),
lwd=2, bty="n", cex=0.75)
with(tden, polygon(c(x, x[length(x):1]),
c(y*3/max(y)-3.5, rep(-3.5, length(x))),
col="gray", border=NA, fillOddEven=TRUE))
```

Liang CJ and Heagerty PJ (2016). A risk-based measure of time-varying prognostic discrimination for survival models. *Biometrics*. doi:10.1111/biom.12628

Gerds TA and Schumacher M (2016). Discussion of “A risk-based measure of time-varying prognostic discrimination for survival models,” by C. Jason Liang and Patrick J. Heagerty. *Biometrics*. doi:10.1111/biom.12629

Parast L and Rutter CM (2016). Discussion of “A risk-based measure of time-varying prognostic discrimination for survival models,” by C. Jason Liang and Patrick J. Heagerty. *Biometrics*. doi:10.1111/biom.12630

Michael H and Tian L (2016). Discussion of “a risk-based measure of time-varying prognostic discrimination for survival models,” by C. Jason Liang and Patrick J. Heagerty. *Biometrics*. doi:10.1111/biom.12631

Liang CJ and Heagerty PJ (2016). Rejoinder to discussions on: A risk-based measure of time-varying prognostic discrimination for survival models. *Biometrics*. doi:10.1111/biom.12632

Saha-Chaudhuri P and Heagerty PJ (2013). Non-parametric estimation of a time-dependent predictive accuracy curve. *Biostatistics*, 14(1), 42-59. doi: 10.1093/biostatistics/kxs021

Heagerty PJ and Zheng Y (2005). Survival model predictive accuracy and ROC curves. *Biometrics*, 61: 92–105. doi:10.1111/j.0006-341X.2005.030814.x

Heagerty PJ, Lumley T, and Pepe MS (2000). Time-Dependent ROC curves for censored survival data and a diagnostic marker. *Biometrics*, 56: 337–344. doi:10.1111/j.0006-341X.2000.00337.x

Uno H, Tian L, Cai T, Kohane IS, and Wei LJ (2013). A unified inference procedure for a class of measures to assess improvement in risk prediction systems with survival data. *Statistics in Medicine*, 32: 2430–2442. doi:10.1002/sim.5647

Chambless LE, Cummiskey CP, and Cui G (2011). Several methods to assess improvement in risk prediction models: Extension to survival analysis. *Statistics in Medicine*, 30: 22–38. doi:10.1002/sim.4026

Pencina MJ, D' Agostino, RB, D' Agostino, RB, and Vasan RS (2008). Evaluating the added predictive ability of a new marker: From area under the ROC curve to reclassification and beyond. *Statistics in Medicine*, 27: 157–172. doi:10.1002/sim.2929

Yates JF (1982). External correspondence: Decompositions of the mean probability score. *Organizational Behavior and Human Performance*, 30: 132–156. doi:10.1016/0030-5073(82)90237-9

van der Vaart AW and Wellner JA (2007). Empirical processes indexed by estimated functions. *IMS Lecture Notes Monograph
Series*, 55: 234–252. doi:10.1214/074921707000000382

Tian L, Zucker D, and Wei LJ (2005). On the Cox model with time-varying regression coefficients. *Journal of the American Statistical Association*, 100(469):172-83. doi:10.1198/016214504000000845

Cai Z and Sun Y (2003). Local linear estimation for time-dependent coefficients in Cox’s regression models. *Scandinavian
Journal of Statistics*, 30: 93–111. doi:10.1111/1467-9469.00320

**Any scripts or data that you put into this service are public.**

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.