File: obtain.optimal.measures.R

package info (click to toggle)
r-cran-optimalcutpoints 1.1-5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 432 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 801 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
obtain.optimal.measures <-
function(value, measures.acc) {
	position <- which(measures.acc$cutoffs %in% value)
	
	Se.v <- measures.acc$Se[position,,drop = FALSE]
	Sp.v <- measures.acc$Sp[position,,drop = FALSE]	
	PPV.v <- measures.acc$PPV[position,,drop = FALSE]	
	NPV.v <- measures.acc$NPV[position,,drop = FALSE]	
	DLR.Positive.v <- measures.acc$DLR.Positive[position,,drop = FALSE]
	DLR.Negative.v <- measures.acc$DLR.Negative[position,,drop = FALSE]

	FP <- measures.acc$n$h*(1-Sp.v)
	FN <- measures.acc$n$d*(1-Se.v)
	if(ncol(Se.v) == 3) { #Confidence intervals
		FP[,c(2,3)] <- NA
		FN[,c(2,3)] <- NA
	}
	res <- list(cutoff = value, Se = Se.v, Sp = Sp.v, PPV = PPV.v, NPV = NPV.v, DLR.Positive = DLR.Positive.v, DLR.Negative = DLR.Negative.v, FP = FP, FN = FN)
	return(res)
}