R/function.MaxSe.R

Defines functions function.MaxSe

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
}

Try the OptimalCutpoints package in your browser

Any scripts or data that you put into this service are public.

OptimalCutpoints documentation built on Oct. 7, 2021, 5:09 p.m.