More seriously, the `marginIndex`

argument is here to indicate how many upper statistics you want to put at the right of your estimate. If it is equal to zero, then you consider the max of the sample as your quantile estimate, if it is equal to 1, the second largest value, and so on. It was defined during the CEMRACS 2006 when OpenTURNS was not even publicly released, so it is quite an old piece of code. And yes, the description is not correct. Concerning the constructor, the objective of this class was to provide a sampler of Wilk’s upper bound, hence the choice of a random vector. If you already have a sample at hand, it is too late: what is the interest of computing a sample size in this case? But if you provide an actual use-case for this class I can move things to ease your job .

Concerning your suggestion, it CANNOT work except for beta=0.5. If you link the rank of the order statistics to take as an estimate of a quantile upper bound to the quantile level, then the confidence level is fixed! In your case, if you choose the rank of the empirical quantile as the rank of your quantile estimate, you will get an asymptotic confidence of 0.5 as this estimator is consistent and asymptotically Gaussian (thus symmetrical).

I started to see what appends in this class. Here is what I get (the OT output is in blue, the analytical result for the maximum is in orange). So everything is good except for the low confidence levels. I suspect the initialization of the sequential search, not the easiest part of the code…