The goal of surverify is to implement concordance statistics in R using modern package development tools (one might even say "in a tidy way", though I would elect not to).
Install from github with
install_github("Alanocallaghan/surverify")
Here's a demo showing I calculate Uno's C correctly.
load_all()
#> Loading surverify
#>
#> Attaching package: 'testthat'
#> The following object is masked from 'package:devtools':
#>
#> test_file
library("survival")
library("survAUC")
TR <- ovarian[1:16,]
TE <- ovarian[17:26,]
train.fit <- coxph(
Surv(futime, fustat) ~ age,
x = TRUE,
y = TRUE,
method = "breslow",
data = TR
)
lpnew <- predict(train.fit, newdata = TE)
#>
#> Attaching package: 'stats'
#> The following object is masked from 'package:surverify':
#>
#> stepfun
Surv.rsp <- Surv(TR$futime, TR$fustat)
Surv.rsp.new <- Surv(TE$futime, TE$fustat)
Cstat <- UnoC(Surv.rsp, Surv.rsp.new, lpnew)
cme <- uno_c(Surv.rsp, Surv.rsp.new, lpnew)
Cstat
#> [1] 0.7333333
cme
#> [1] 0.7333333
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.