Recover the number of Monte Carlo replicates behind a binomial estimate
Source:R/uncertainty_propagation.R
binomial_replicate_count.RdOperating characteristics are stored as summaries (estimate, Monte Carlo standard error, exact confidence interval) rather than as the underlying counts. Propagating their uncertainty correctly requires the replicate count, which this function recovers from whichever summary is informative.
The Monte Carlo standard error identifies the replicate count exactly whenever it is available and non-zero. It is zero precisely when no replicate succeeded or all of them did, and in that case one bound of the exact interval is a closed-form function of the replicate count alone. As a last resort, when no standard error was stored for an interior estimate, the count is approximated from the width of the interval.