Binomial functions in the Stochastic DuckDB extension
Function category
Binomial
19 functionsBinomial — number of successes in n independent Bernoulli trials at probability p.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the cumulative distribution function (CDF) of the binomial distribution. Returns the probability that a random variable X is less than or equal to x.
SELECT dist_binomial_cdf(10, 0.5, 5);
Output
| dist_binomial_cdf(10, 0.5, 5) |
|---|
| 0.623046875 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the complementary cumulative distribution function (1 - CDF) of the binomial distribution. Returns the probability that X > x, equivalent to the survival function.
SELECT dist_binomial_cdf_complement(10, 0.5, 5);
Output
| dist_binomial_cdf_complement(10, 0.5, 5) |
|---|
| 0.376953125 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the cumulative hazard function of the binomial distribution.
SELECT dist_binomial_chf(10, 0.5, 5);
Output
| dist_binomial_chf(10, 0.5, 5) |
|---|
| 0.9756344361346222 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the hazard function of the binomial distribution.
SELECT dist_binomial_hazard(10, 0.5, 5);
Output
| dist_binomial_hazard(10, 0.5, 5) |
|---|
| 0.652849740932643 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the kurtosis of the binomial distribution.
SELECT dist_binomial_kurtosis(10, 0.5);
Output
| dist_binomial_kurtosis(10, 0.5) |
|---|
| 2.8 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the excess kurtosis of the binomial distribution.
SELECT dist_binomial_kurtosis_excess(10, 0.5);
Output
| dist_binomial_kurtosis_excess(10, 0.5) |
|---|
| -0.2 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the natural logarithm of the cumulative distribution function (CDF) of the binomial distribution. Returns the logarithm of the probability that a random variable X is less than or equal to x.
SELECT dist_binomial_log_cdf(10, 0.5, 5);
Output
| dist_binomial_log_cdf(10, 0.5, 5) |
|---|
| -0.4731335222546632 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the natural logarithm of the complementary cumulative distribution function (1 - CDF) of the binomial distribution. Returns the logarithm of the probability that X > x, equivalent to the survival function.
SELECT dist_binomial_log_cdf_complement(10, 0.5, 5);
Output
| dist_binomial_log_cdf_complement(10, 0.5, 5) |
|---|
| -0.9756344361346222 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the natural logarithm of the probability density function (log-PDF) of the binomial distribution. Useful for numerical stability when dealing with very small probabilities.
SELECT dist_binomial_log_pdf(10, 0.5, 5);
Output
| dist_binomial_log_pdf(10, 0.5, 5) |
|---|
| -1.402042718088029 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the median (50th percentile) of the binomial distribution, which equals the mean.
SELECT dist_binomial_median(10, 0.5);
Output
| dist_binomial_median(10, 0.5) |
|---|
| 5.0 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the mode (most likely value) of the binomial distribution, which equals the mean.
SELECT dist_binomial_mode(10, 0.5);
Output
| dist_binomial_mode(10, 0.5) |
|---|
| 5.0 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the probability density function (PDF) of the binomial distribution. Returns the probability densityat point x for a binomial distribution with specified parameters.
SELECT dist_binomial_pdf(10, 0.5, 5);
Output
| dist_binomial_pdf(10, 0.5, 5) |
|---|
| 0.2460937500000002 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the quantile function (inverse CDF) of the binomial distribution. Returns the value x such that P(X ≤ x) = p, where p is the cumulative probability.
SELECT dist_binomial_quantile(10, 0.5, 0.95);
Output
| dist_binomial_quantile(10, 0.5, 0.95) |
|---|
| 8 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the complementary quantile function of the binomial distribution. Returns the value x such that P(X > x) = p, useful for computing upper tail quantiles.
SELECT dist_binomial_quantile_complement(10, 0.5, 0.05);
Output
| dist_binomial_quantile_complement(10, 0.5, 0.05) |
|---|
| 8 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the range of the binomial distribution.
SELECT dist_binomial_range(10, 0.5);
Output
| dist_binomial_range(10, 0.5) |
|---|
| (0.0, 10.0) |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Generates random samples from the binomial distribution with specified parameters.
SELECT dist_binomial_sample(10, 0.5);
Output
| dist_binomial_sample(10, 0.5) |
|---|
| 2 |
Related functions
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the skewness of the binomial distribution.
SELECT dist_binomial_skewness(10, 0.5);
Output
| dist_binomial_skewness(10, 0.5) |
|---|
| 0.0 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the support of the binomial distribution.
SELECT dist_binomial_support(10, 0.5);
Output
| dist_binomial_support(10, 0.5) |
|---|
| (0.0, 10.0) |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
trials
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the variance (σ²) of the binomial distribution.
SELECT dist_binomial_variance(10, 0.5);
Output
| dist_binomial_variance(10, 0.5) |
|---|
| 2.5 |
Related functions
- dist_binomial_sample() — Generates random samples from the binomial distribution with specified parameters
- dist_binomial_pdf() — Computes the probability density function (PDF) of the binomial distribution
- dist_binomial_cdf() — Computes the cumulative distribution function (CDF) of the binomial distribution
- dist_binomial_quantile() — Computes the quantile function (inverse CDF) of the binomial distribution