sens10: Sensitivity at theshold quantile 10%

View source: R/OptHoldoutSize_aspre.R

sens10R Documentation

Sensitivity at theshold quantile 10%

Description

Computes sensitivity of a risk score at a threshold at which 10% of samples (or some proportion pi_int) are above the threshold.

Usage

sens10(Y, Ypred, pi_int = 0.1)

Arguments

Y

True labels (1 or 0)

Ypred

Predictions (univariate; real numbers)

pi_int

Compute sensitivity when a proportion pi_int of samples exceed threshold, default 0.1

Value

Sensitivity at this threshold

Examples


# Simulate
set.seed(32142)

N=1000
X=rnorm(N); Y=rbinom(N,1,prob=logit(X/2))

pi_int=0.1
q10=quantile(X,1-pi_int) # 10% of X values are above this threshold

print(length(which(Y==1 & X>q10))/length(which(X>q10)))
print(sens10(Y,X,pi_int))


OptHoldoutSize documentation built on April 12, 2025, 1:34 a.m.