File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ nonParametricPV <- function(outcome, score) {
32
32
thresh.predictions <- lapply(score , function (x ) as.numeric(score > x ))
33
33
34
34
ppv <- vapply(
35
- thresh.predictions [ 1 : (length( score ) - 1 )] ,
35
+ thresh.predictions ,
36
36
function (x ) {
37
37
tp <- sum(outcome == 1 & x == 1 )
38
38
fp <- sum(outcome == 0 & x == 1 )
@@ -42,7 +42,7 @@ nonParametricPV <- function(outcome, score) {
42
42
)
43
43
44
44
npv <- vapply(
45
- thresh.predictions [ 1 : (length( score ) - 1 )] ,
45
+ thresh.predictions ,
46
46
function (x ) {
47
47
tn <- sum(outcome == 0 & x == 0 )
48
48
fn <- sum(outcome == 1 & x == 0 )
@@ -54,8 +54,8 @@ nonParametricPV <- function(outcome, score) {
54
54
threshold.data <- data.frame (
55
55
score = score ,
56
56
percentile = ecdf(score )(score ),
57
- PPV = c( prev , ppv ) ,
58
- NPV = c( npv , 1 - prev )
57
+ PPV = ppv ,
58
+ NPV = npv
59
59
) %> %
60
60
mutate(MNPV = 1 - .data $ NPV ) %> %
61
61
tidyr :: fill(
You can’t perform that action at this time.
0 commit comments