View source: R/OptHoldoutSize_aspre.R
sens10 | R Documentation |
Computes sensitivity of a risk score at a threshold at which 10% of samples (or some proportion pi_int) are above the threshold.
sens10(Y, Ypred, pi_int = 0.1)
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 |
Sensitivity at this threshold
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.