Negative Binomial functions in the Stochastic DuckDB extension
Function category
Negative Binomial
19 functionsNegative Binomial — number of failures before r successes. Used for over-dispersed count data.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Returns the probability that a random variable X is less than or equal to x.
SELECT dist_negative_binomial_cdf(10, 0.5, 5);
Output
| dist_negative_binomial_cdf(10, 0.5, 5) |
|---|
| 0.15087890624999997 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Returns the probability that X > x, equivalent to the survival function.
SELECT dist_negative_binomial_cdf_complement(10, 0.5, 5);
Output
| dist_negative_binomial_cdf_complement(10, 0.5, 5) |
|---|
| 0.84912109375 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution.
SELECT dist_negative_binomial_chf(10, 0.5, 5);
Output
| dist_negative_binomial_chf(10, 0.5, 5) |
|---|
| 0.16355347180511537 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution.
SELECT dist_negative_binomial_hazard(10, 0.5, 5);
Output
| dist_negative_binomial_hazard(10, 0.5, 5) |
|---|
| 0.07195227142035647 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the kurtosis of the negative_binomial distribution.
SELECT dist_negative_binomial_kurtosis(10, 0.5);
Output
| dist_negative_binomial_kurtosis(10, 0.5) |
|---|
| 3.65 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the excess kurtosis of the negative_binomial distribution.
SELECT dist_negative_binomial_kurtosis_excess(10, 0.5);
Output
| dist_negative_binomial_kurtosis_excess(10, 0.5) |
|---|
| 0.65 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Returns the logarithm of the probability that a random variable X is less than or equal to x.
SELECT dist_negative_binomial_log_cdf(10, 0.5, 5);
Output
| dist_negative_binomial_log_cdf(10, 0.5, 5) |
|---|
| -1.891277709261653 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Returns the logarithm of the probability that X > x, equivalent to the survival function.
SELECT dist_negative_binomial_log_cdf_complement(10, 0.5, 5);
Output
| dist_negative_binomial_log_cdf_complement(10, 0.5, 5) |
|---|
| -0.16355347180511537 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Useful for numerical stability when dealing with very small probabilities.
SELECT dist_negative_binomial_log_pdf(10, 0.5, 5);
Output
| dist_negative_binomial_log_pdf(10, 0.5, 5) |
|---|
| -2.7953057485240147 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the median (50th percentile) of the negative_binomial distribution, which equals the mean.
SELECT dist_negative_binomial_median(10, 0.5);
Output
| dist_negative_binomial_median(10, 0.5) |
|---|
| 9.0 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the mode (most likely value) of the negative_binomial distribution, which equals the mean.
SELECT dist_negative_binomial_mode(10, 0.5);
Output
| dist_negative_binomial_mode(10, 0.5) |
|---|
| 9.0 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Returns the probability densityat point x for a negative_binomial distribution with specified parameters.
SELECT dist_negative_binomial_pdf(10, 0.5, 5);
Output
| dist_negative_binomial_pdf(10, 0.5, 5) |
|---|
| 0.06109619140624995 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Returns the value x such that P(X ≤ x) = p, where p is the cumulative probability.
SELECT dist_negative_binomial_quantile(10, 0.5, 0.95);
Output
| dist_negative_binomial_quantile(10, 0.5, 0.95) |
|---|
| 18 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
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 negative_binomial distribution. Returns the value x such that P(X > x) = p, useful for computing upper tail quantiles.
SELECT dist_negative_binomial_quantile_complement(10, 0.5, 0.05);
Output
| dist_negative_binomial_quantile_complement(10, 0.5, 0.05) |
|---|
| 18 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the range of the negative_binomial distribution.
SELECT dist_negative_binomial_range(10, 0.5);
Output
| dist_negative_binomial_range(10, 0.5) |
|---|
| (0.0, 1.7976931348623157e+308) |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Generates random samples from the negative_binomial distribution with specified parameters.
SELECT dist_negative_binomial_sample(10, 0.5);
Output
| dist_negative_binomial_sample(10, 0.5) |
|---|
| 7 |
Related functions
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the skewness of the negative_binomial distribution.
SELECT dist_negative_binomial_skewness(10, 0.5);
Output
| dist_negative_binomial_skewness(10, 0.5) |
|---|
| 0.6708203932499369 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the support of the negative_binomial distribution.
SELECT dist_negative_binomial_support(10, 0.5);
Output
| dist_negative_binomial_support(10, 0.5) |
|---|
| (0.0, 1.7976931348623157e+308) |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
successes
|
Type
BIGINT
|
Mode Positional | Description |
Argument
prob
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the variance (σ²) of the negative_binomial distribution.
SELECT dist_negative_binomial_variance(10, 0.5);
Output
| dist_negative_binomial_variance(10, 0.5) |
|---|
| 20.0 |
Related functions
- dist_negative_binomial_sample() — Generates random samples from the negative_binomial distribution with specified parameters
- dist_negative_binomial_pdf() — Computes the probability density function (PDF) of the negative_binomial distribution
- dist_negative_binomial_cdf() — Computes the cumulative distribution function (CDF) of the negative_binomial distribution
- dist_negative_binomial_quantile() — Computes the quantile function (inverse CDF) of the negative_binomial distribution