# 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))
Run the code above in your browser using DataLab