Skip to content

Commit 4be0e01

Browse files
committed
Merge branch '8_yardstick_speed_up' of https://github.com/Genentech/stats4phc into 8_yardstick_speed_up
2 parents ee12893 + 777528d commit 4be0e01

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/PV.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ nonParametricPV <- function(outcome, score) {
3232
thresh.predictions <- lapply(score, function(x) as.numeric(score > x))
3333

3434
ppv <- vapply(
35-
thresh.predictions[1:(length(score) - 1)],
35+
thresh.predictions,
3636
function(x) {
3737
tp <- sum(outcome == 1 & x == 1)
3838
fp <- sum(outcome == 0 & x == 1)
@@ -42,7 +42,7 @@ nonParametricPV <- function(outcome, score) {
4242
)
4343

4444
npv <- vapply(
45-
thresh.predictions[1:(length(score) - 1)],
45+
thresh.predictions,
4646
function(x) {
4747
tn <- sum(outcome == 0 & x == 0)
4848
fn <- sum(outcome == 1 & x == 0)
@@ -54,8 +54,8 @@ nonParametricPV <- function(outcome, score) {
5454
threshold.data <- data.frame(
5555
score = score,
5656
percentile = ecdf(score)(score),
57-
PPV = c(prev, ppv),
58-
NPV = c(npv, 1 - prev)
57+
PPV = ppv,
58+
NPV = npv
5959
) %>%
6060
mutate(MNPV = 1 - .data$NPV) %>%
6161
tidyr::fill(

0 commit comments

Comments
 (0)