Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/surv-roc_auc_survival.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' specific _evaluation times_ and, for each time, computes the area under the
#' ROC curve. To account for censoring, inverse probability of censoring weights
#' (IPCW) are used in the calculations. See equation 7 of section 4.3 in
#' Blanche _at al_ (2013) for the details.
#' Blanche _et al_ (2013) for the details.
#'
#' The column passed to `...` should be a list column with one element per
#' independent experiential unit (e.g. patient). The list column should contain
Expand Down
12 changes: 7 additions & 5 deletions R/surv-roc_curve_survival.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' This formulation takes survival probability predictions at one or more
#' specific _evaluation times_ and, for each time, computes the ROC curve. To
#' account for censoring, inverse probability of censoring weights (IPCW) are
#' used in the calculations. See equation 7 of section 4.3 in Blanche _at al_
#' used in the calculations. See equation 7 of section 4.3 in Blanche _et al_
#' (2013) for the details.
#'
#' The column passed to `...` should be a list column with one element per
Expand Down Expand Up @@ -221,8 +221,9 @@ roc_curve_survival_impl_one <- function(event_time, delta, data, case_weights) {

specificity <- vapply(
data_split,
function(x)
sum(x$ge_time * x$weight_censored * x$case_weights, na.rm = TRUE),
function(x) {
sum(x$ge_time * x$weight_censored * x$case_weights, na.rm = TRUE)
},
FUN.VALUE = numeric(1)
)
specificity <- cumsum(specificity)
Expand All @@ -235,11 +236,12 @@ roc_curve_survival_impl_one <- function(event_time, delta, data, case_weights) {

sensitivity <- vapply(
data_split,
function(x)
function(x) {
sum(
x$le_time * x$delta * x$weight_censored * x$case_weights,
na.rm = TRUE
),
)
},
FUN.VALUE = numeric(1)
)

Expand Down