Description Usage Arguments Details Value Author(s) References Examples

This function estimates of TP and FP based on a Cox model as discussed in Heagerty and Zheng, 2005, for incident/dynamic ROC curve. TP is estimated as Equation (1) and FP is estimated as Equation (2) of the paper.

1 | ```
CoxWeights(marker, Stime, status, predict.time, entry)
``` |

`marker` |
estimated linear predictor from a set of covariates. Note that this linear predictor can be obtained from any model. |

`Stime` |
For right censored data, this is the follow up time. For left truncated data, this is the ending time for the interval. |

`status` |
Indicator of status, 1 if death or event, 0 otherwise. |

`predict.time` |
Time point of the ROC curve. |

`entry` |
For left truncated data, this is the entry time of the interval. The default is set to NULL for right censored data. |

Suppose we have censored survival data (right censored or both
left-truncated and right censored data) along with a
marker value and we want to see how well the marker predicts the
survival time for the subjects in the dataset using Incident/dynamic
definition of ROC curve. In particular,
suppose we have survival times in days and we want to see how well the
marker predicts the one-year survival (predict.time=365 days). This
function CoxWeights(), returns the unique marker values, TP (True
Positive), FP (False Positive) and AUC (Area under (ROC) curve)
corresponding to the time point of interest (predict.time). Note that
the linear predictor *marker* can be obtained from any model,
specifically, the survival model may be based on either a PH
or a time-varying Cox model.

Returns a list of the following items:

`eta` |
unique marker values for calculation of TP and FP |

`TP` |
True Positive values corresponding to unique marker values |

`FP` |
False Positive values corresponding to unique marker values |

`AUC` |
Area Under (ROC) Curve at time predict.time |

Patrick J. Heagerty

Heagerty, P.J., Zheng Y. (2005)
Survival Model Predictive Accuracy and ROC curves
*Biometrics*, **61**, 92 – 105

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
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[VA$stime > 500 ] <- 0
survival.time[VA$stime > 500 ] <- 500
library(survival)
fit0 <- coxph( Surv(survival.time,survival.status)
~ score + cell.type + tx + age, na.action=na.omit )
summary(fit0)
eta <- fit0$linear.predictor
AUC <- NULL
out <- CoxWeights(marker=eta, Stime=survival.time, status=survival.status,
predict.time=30)
## to see how well the marker predicts one-month survival
AUC <- out$AUC
``` |

```
Loading required package: survival
Loading required package: MASS
Call:
coxph(formula = Surv(survival.time, survival.status) ~ score +
cell.type + tx + age, na.action = na.omit)
n= 137, number of events= 124
coef exp(coef) se(coef) z Pr(>|z|)
score -0.032176 0.968336 0.005425 -5.931 3.01e-09 ***
cell.type2 0.841188 2.319121 0.269982 3.116 0.00183 **
cell.type3 1.150691 3.160375 0.295364 3.896 9.79e-05 ***
cell.type4 0.350346 1.419559 0.284620 1.231 0.21835
tx -0.322580 0.724278 0.205936 -1.566 0.11725
age -0.008675 0.991363 0.009255 -0.937 0.34862
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
exp(coef) exp(-coef) lower .95 upper .95
score 0.9683 1.0327 0.9581 0.9787
cell.type2 2.3191 0.4312 1.3662 3.9367
cell.type3 3.1604 0.3164 1.7714 5.6384
cell.type4 1.4196 0.7044 0.8126 2.4798
tx 0.7243 1.3807 0.4837 1.0844
age 0.9914 1.0087 0.9735 1.0095
Concordance= 0.738 (se = 0.03 )
Rsquare= 0.357 (max possible= 0.999 )
Likelihood ratio test= 60.53 on 6 df, p=3.519e-11
Wald test = 61.09 on 6 df, p=2.703e-11
Score (logrank) test = 65.25 on 6 df, p=3.827e-12
```

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.