Expand description
Binomial Distribution Module containing functions to the Binomial Distribution.
Implemented by statrs::distribution::Binomial.
The Binomial Distribution has two parameters:
n: n ∈ N (natural numbers)
p: 0 ≤ p ≤ 1
Usage:
binomial_pmf(x, n, p)
binomial_ln_pmf(x, n, p)
binomial_cdf(x, n, p)
binomial_sf(x, n, p)
with
x: 0 ≤ x ≤ n UInt64/BIGINT UNSIGNED,
n: 0 ≤ n UInt64/BIGINT UNSIGNED,
p: [0, 1] Float64/DOUBLE
Examples
#[tokio::main(flavor = "current_thread")]
async fn main() -> std::io::Result<()> {
let mut ctx = datafusion::prelude::SessionContext::new();
datafusion_statrs::distribution::binomial::register(&mut ctx)?;
ctx.sql("SELECT binomial_cdf(CAST(2 AS BIGINT UNSIGNED), CAST(5 AS BIGINT UNSIGNED), 0.2)").await?
.show().await?;
Ok(())
}