Expand description
Streaming moments and Bernoulli intervals for Monte Carlo hit statistics.
Welford accumulates a running mean and variance in constant memory, one trial at a
time, so an adaptive Monte Carlo driver never needs to retain the full trial history just
to report a standard deviation. wilson_interval is the classic fixed-n confidence
interval for a Bernoulli hit/miss proportion, evaluated at one of three pinned confidence
levels (ConfidenceLevel). BernoulliConfidenceSequence is the anytime-valid
beta-binomial-mixture counterpart to wilson_interval: it lets an adaptive driver peek at
partial results after every trial, and stop on a data-dependent rule, without inflating its
error rate (Task 3 of Plan C, MBA-1352).
No randomness lives in the production path: this module consumes trial outcomes a caller
already produced (MonteCarloTrialSampler::sample_one_trial in src/cli_api.rs, the one
trial body both the legacy fixed-count loop and the adaptive driver run) and is pure std
math only – no rand, no fs, no clap – so it compiles for wasm32-unknown-unknown
unconditionally. (One #[cfg(test)] test, the empirical coverage check, does draw from a
seeded rand generator; nothing outside #[cfg(test)] does.)
Structs§
- Bernoulli
Confidence Sequence - Anytime-valid confidence sequence for a Bernoulli proportion: Robbins’ beta-binomial mixture
with a uniform
Beta(1, 1)prior. - Welford
- Online (streaming) mean and variance via Welford’s algorithm.
Enums§
- Confidence
Level - A confidence level pinned to one of three fixed two-sided critical values.
Functions§
- wilson_
interval - Wilson score interval for a Bernoulli proportion at fixed
n.