ef3m
Concept Overview
Section titled “Concept Overview”Exact Fit of the first 3, 4 or 5 Moments: fits a mixture of two Gaussians by matching sample moments instead of by maximum likelihood. M2N takes the observed moments and searches over the second mean and the mixing probability, solving the remaining parameters analytically at each candidate (iter_4 and iter_5 for the four- and five-moment variants); most_likely_parameters then picks the modal solution across that search. It is fast and derivative-free, which is what makes it usable as an initialiser.
When to Use
Section titled “When to Use”Use it when a return or bet-outcome distribution is visibly bimodal — two regimes, or a mixture of trades that ran and trades that were stopped — and you want the components without paying for EM. It is the standard way to obtain the mixture parameters bet_size_reserve needs. Because it works from higher moments it is sensitive to tail estimation noise, so on small samples treat its output as an initialisation for a heavier optimiser rather than a final answer.
Mathematical Foundations
Section titled “Mathematical Foundations”Raw Moment
Section titled “Raw Moment”
Mixture Mean
Section titled “Mixture Mean”
Usage Examples
Section titled “Usage Examples”Estimate moments
Section titled “Estimate moments”use openquant::ef3m::centered_moment;
let moments = vec![0.0, 1.0, 0.1, 3.0];let m3 = centered_moment(&moments, 3);API Reference
Section titled “API Reference”Python API
Section titled “Python API”ef3m.centered_momentef3m.raw_momentef3m.most_likely_parametersef3m.fit_m2n
Rust API
Section titled “Rust API”M2Ncentered_momentraw_momentmost_likely_parameters
Risk Notes and Caveats
Section titled “Risk Notes and Caveats”- Use as initialization for more expensive optimizers.
- Sensitive to higher-moment estimation noise.