MCPcopy Create free account
hub / github.com/Open-Quant/openquant / cdf_mixture

Function cdf_mixture

crates/openquant/src/bet_sizing.rs:423–427  ·  view source on GitHub ↗
(mu1: f64, mu2: f64, sigma1: f64, sigma2: f64, p1: f64, x: f64)

Source from the content-addressed store, hash-verified

421}
422
423pub fn cdf_mixture(mu1: f64, mu2: f64, sigma1: f64, sigma2: f64, p1: f64, x: f64) -> f64 {
424 let n1 = Normal::new(mu1, sigma1.max(1e-8)).unwrap();
425 let n2 = Normal::new(mu2, sigma2.max(1e-8)).unwrap();
426 p1 * n1.cdf(x) + (1.0 - p1) * n2.cdf(x)
427}
428
429fn normal_pdf(x: f64, mu: f64, sigma: f64) -> f64 {
430 let s = sigma.max(1e-8);

Calls

no outgoing calls