Bernoulli functions in the Stochastic DuckDB extension
Function category
Bernoulli
21 functionsBernoulli — single yes/no trial with success probability p. Foundation of every binary outcome model.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the cumulative distribution function (CDF) of the bernoulli distribution. Returns the probability that a random variable X is less than or equal to x.
SELECT dist_bernoulli_cdf(0.5, 0);
Output
| dist_bernoulli_cdf(0.5, 0) |
|---|
| 0.5 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the complementary cumulative distribution function (1 - CDF) of the bernoulli distribution. Returns the probability that X > x, equivalent to the survival function.
SELECT dist_bernoulli_cdf_complement(0.5, 0);
Output
| dist_bernoulli_cdf_complement(0.5, 0) |
|---|
| 0.5 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the cumulative hazard function of the bernoulli distribution.
SELECT dist_bernoulli_chf(0.5, 0);
Output
| dist_bernoulli_chf(0.5, 0) |
|---|
| 0.6931471805599453 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the hazard function of the bernoulli distribution.
SELECT dist_bernoulli_hazard(0.5, 0);
Output
| dist_bernoulli_hazard(0.5, 0) |
|---|
| 1.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the kurtosis of the bernoulli distribution.
SELECT dist_bernoulli_kurtosis(0.5);
Output
| dist_bernoulli_kurtosis(0.5) |
|---|
| 1.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the excess kurtosis of the bernoulli distribution.
SELECT dist_bernoulli_kurtosis_excess(0.5);
Output
| dist_bernoulli_kurtosis_excess(0.5) |
|---|
| -2.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
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 bernoulli distribution. Returns the logarithm of the probability that a random variable X is less than or equal to x.
SELECT dist_bernoulli_log_cdf(0.5, 0);
Output
| dist_bernoulli_log_cdf(0.5, 0) |
|---|
| -0.6931471805599453 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
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 bernoulli distribution. Returns the logarithm of the probability that X > x, equivalent to the survival function.
SELECT dist_bernoulli_log_cdf_complement(0.5, 0);
Output
| dist_bernoulli_log_cdf_complement(0.5, 0) |
|---|
| -0.6931471805599453 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
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 bernoulli distribution. Useful for numerical stability when dealing with very small probabilities.
SELECT dist_bernoulli_log_pdf(0.5, 1);
Output
| dist_bernoulli_log_pdf(0.5, 1) |
|---|
| -0.6931471805599453 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the mean (μ) of the bernoulli distribution, which is the first moment.
SELECT dist_bernoulli_mean(0.5);
Output
| dist_bernoulli_mean(0.5) |
|---|
| 0.5 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the median (50th percentile) of the bernoulli distribution, which equals the mean.
SELECT dist_bernoulli_median(0.5);
Output
| dist_bernoulli_median(0.5) |
|---|
| 0.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the mode (most likely value) of the bernoulli distribution, which equals the mean.
SELECT dist_bernoulli_mode(0.5);
Output
| dist_bernoulli_mode(0.5) |
|---|
| 0.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the probability density function (PDF) of the bernoulli distribution. Returns the probability densityat point x for a bernoulli distribution with specified parameters.
SELECT dist_bernoulli_pdf(0.5, 1);
Output
| dist_bernoulli_pdf(0.5, 1) |
|---|
| 0.5 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the quantile function (inverse CDF) of the bernoulli distribution. Returns the value x such that P(X ≤ x) = p, where p is the cumulative probability.
SELECT dist_bernoulli_quantile(0.5, 0.95);
Output
| dist_bernoulli_quantile(0.5, 0.95) |
|---|
| 1.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the complementary quantile function of the bernoulli distribution. Returns the value x such that P(X > x) = p, useful for computing upper tail quantiles.
SELECT dist_bernoulli_quantile_complement(0.5, 0.05);
Output
| dist_bernoulli_quantile_complement(0.5, 0.05) |
|---|
| 1.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the range of the bernoulli distribution.
SELECT dist_bernoulli_range(0.5);
Output
| dist_bernoulli_range(0.5) |
|---|
| (0.0, 1.0) |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Generates random samples from the bernoulli distribution with specified parameters.
SELECT dist_bernoulli_sample(0.5);
Output
| dist_bernoulli_sample(0.5) |
|---|
| true |
Related functions
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the skewness of the bernoulli distribution.
SELECT dist_bernoulli_skewness(0.5);
Output
| dist_bernoulli_skewness(0.5) |
|---|
| 0.0 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the standard deviation (σ) of the bernoulli distribution.
SELECT dist_bernoulli_stddev(0.5);
Output
| dist_bernoulli_stddev(0.5) |
|---|
| 0.5 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the support of the bernoulli distribution.
SELECT dist_bernoulli_support(0.5);
Output
| dist_bernoulli_support(0.5) |
|---|
| (0.0, 1.0) |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the variance (σ²) of the bernoulli distribution.
SELECT dist_bernoulli_variance(0.5);
Output
| dist_bernoulli_variance(0.5) |
|---|
| 0.25 |
Related functions
- dist_bernoulli_sample() — Generates random samples from the bernoulli distribution with specified parameters
- dist_bernoulli_pdf() — Computes the probability density function (PDF) of the bernoulli distribution
- dist_bernoulli_cdf() — Computes the cumulative distribution function (CDF) of the bernoulli distribution
- dist_bernoulli_quantile() — Computes the quantile function (inverse CDF) of the bernoulli distribution
- dist_bernoulli_mean() — Returns the mean (μ) of the bernoulli distribution, which is the first moment
- dist_bernoulli_stddev() — Returns the standard deviation (σ) of the bernoulli distribution