File: function.MaxSe.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 (19 lines) | stat: -rw-r--r-- 769 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
function.MaxSe <-
function(data, marker, status, tag.healthy = 0, direction = c("<", ">"), control = control.cutpoints(), pop.prev, ci.fit = FALSE, conf.level = 0.95, measures.acc){
	direction <- match.arg(direction)   
	
	cutpointsSe <- measures.acc$cutoffs[which(round(measures.acc$Se[,1],10) == round(max(measures.acc$Se[,1],na.rm=TRUE),10))]
		 
	if (length(cutpointsSe)> 1) {
		Spnew <- obtain.optimal.measures(cutpointsSe, measures.acc)$Sp
		cMaxSe <- cutpointsSe[which(round(Spnew[,1],10) == round(max(Spnew[,1],na.rm=TRUE),10))]		
	}
	if (length(cutpointsSe)== 1) {
		cMaxSe <- cutpointsSe
	}

	optimal.cutoff <- obtain.optimal.measures(cMaxSe, measures.acc)

	res <- list(measures.acc = measures.acc, optimal.cutoff = optimal.cutoff)
	res
}