  The Probability Estimation Framework involves direct estimation of the
probability of occurrences of outcomes conditioned on measurement settings and
side information. It is a powerful tool for certifying randomness in quantum
non-locality experiments. In this paper, we present a self-contained proof of
the asymptotic optimality of the method. Our approach refines earlier results
to allow a better characterisation of optimal adversarial attacks on the
protocol. We apply these results to the (2,2,2) Bell scenario, obtaining an
analytic characterisation of the optimal adversarial attacks bound by
no-signalling principles, while also demonstrating the asymptotic robustness of
the PEF method to deviations from expected experimental behaviour. We also
study extensions of the analysis to quantum-limited adversaries in the (2,2,2)
Bell scenario and no-signalling adversaries in higher $(n,m,k)$ Bell scenarios.
