Skip to content

Commit

Permalink
Merge branch '8_yardstick_speed_up' of https://github.com/Genentech/s…
Browse files Browse the repository at this point in the history
…tats4phc into 8_yardstick_speed_up
  • Loading branch information
slamao committed Feb 14, 2025
2 parents ee12893 + 777528d commit 4be0e01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/PV.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ nonParametricPV <- function(outcome, score) {
thresh.predictions <- lapply(score, function(x) as.numeric(score > x))

ppv <- vapply(
thresh.predictions[1:(length(score) - 1)],
thresh.predictions,
function(x) {
tp <- sum(outcome == 1 & x == 1)
fp <- sum(outcome == 0 & x == 1)
Expand All @@ -42,7 +42,7 @@ nonParametricPV <- function(outcome, score) {
)

npv <- vapply(
thresh.predictions[1:(length(score) - 1)],
thresh.predictions,
function(x) {
tn <- sum(outcome == 0 & x == 0)
fn <- sum(outcome == 1 & x == 0)
Expand All @@ -54,8 +54,8 @@ nonParametricPV <- function(outcome, score) {
threshold.data <- data.frame(
score = score,
percentile = ecdf(score)(score),
PPV = c(prev, ppv),
NPV = c(npv, 1 - prev)
PPV = ppv,
NPV = npv
) %>%
mutate(MNPV = 1 - .data$NPV) %>%
tidyr::fill(
Expand Down

0 comments on commit 4be0e01

Please sign in to comment.