Logistic functions in the Stochastic DuckDB extension
Function category
Logistic
24 functionsLogistic distribution — symmetric S-curve via location/scale. Backbone of logistic regression and Elo-style ratings.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x).
SELECT dist_logistic_cdf(0.0, 1.0, 0.5);
Output
| dist_logistic_cdf(0.0, 1.0, 0.5) |
|---|
| 0.6224593312018546 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the complementary cumulative distribution function (survival function) of the logistic distribution, P(X > x).
SELECT dist_logistic_cdf_complement(0.0, 1.0, 0.5);
Output
| dist_logistic_cdf_complement(0.0, 1.0, 0.5) |
|---|
| 0.3775406687981454 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the cumulative hazard function of the logistic distribution at x.
SELECT dist_logistic_chf(0.0, 1.0, 0.5);
Output
| dist_logistic_chf(0.0, 1.0, 0.5) |
|---|
| 0.9740769841801068 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Fits a logistic distribution to x by maximum likelihood (Newton's method). Returns a STRUCT with the fitted parameters (location, scale) followed by the log_likelihood, aic and bic of the fit, or NULL when there are too few or only identical values. The whole sample is held in memory.
SELECT round(dist_logistic_fit(x).aic, 4) AS logistic_aic, round(dist_normal_fit(x).aic, 4) AS normal_aic
FROM (VALUES (0.2), (-0.5), (1.1), (0.4), (-0.1), (2.9), (0.7), (0.0), (-1.8), (0.3)) t(x);
Output
| logistic_aic | normal_aic |
|---|---|
| 34.0263 | 34.9066 |
Related functions
- dist_logistic_ks_test() — One-sample Kolmogorov-Smirnov test of whether x follows the logistic distribution with the given parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the hazard function of the logistic distribution at x.
SELECT dist_logistic_hazard(0.0, 1.0, 0.5);
Output
| dist_logistic_hazard(0.0, 1.0, 0.5) |
|---|
| 0.6224593312018546 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the logistic distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_logistic_ks_test(x, 0.0, 1.0) AS ks
FROM (VALUES (1.2), (0.7), (2.9), (1.8), (0.4), (3.6), (1.1), (2.2), (5.3), (0.9)) t(x);
Output
| ks |
|---|
| {'statistic': 0.598687660112452, 'p_value': 0.001540896163719463} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the kurtosis of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_kurtosis(0.0, 1.0);
Output
| dist_logistic_kurtosis(0.0, 1.0) |
|---|
| 4.2 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the excess kurtosis of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_kurtosis_excess(0.0, 1.0);
Output
| dist_logistic_kurtosis_excess(0.0, 1.0) |
|---|
| 1.2 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
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 logistic distribution.
SELECT dist_logistic_log_cdf(0.0, 1.0, 0.5);
Output
| dist_logistic_log_cdf(0.0, 1.0, 0.5) |
|---|
| -0.4740769841801067 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the natural logarithm of the survival function of the logistic distribution, log P(X > x).
SELECT dist_logistic_log_cdf_complement(0.0, 1.0, 0.5);
Output
| dist_logistic_log_cdf_complement(0.0, 1.0, 0.5) |
|---|
| -0.9740769841801067 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the natural logarithm of the probability density function (PDF) of the logistic distribution at x. Useful for numerical stability when dealing with very small probabilities.
SELECT dist_logistic_log_pdf(0.0, 1.0, 0.5);
Output
| dist_logistic_log_pdf(0.0, 1.0, 0.5) |
|---|
| -1.4481539683602134 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the mean of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_mean(0.0, 1.0);
Output
| dist_logistic_mean(0.0, 1.0) |
|---|
| 0.0 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
- dist_logistic_stddev() — Returns the standard deviation of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the median of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_median(0.0, 1.0);
Output
| dist_logistic_median(0.0, 1.0) |
|---|
| 0.0 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the mode (most likely value) of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_mode(0.0, 1.0);
Output
| dist_logistic_mode(0.0, 1.0) |
|---|
| 0.0 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the probability density function (PDF) of the logistic distribution at x.
SELECT dist_logistic_pdf(0.0, 1.0, 0.5);
Output
| dist_logistic_pdf(0.0, 1.0, 0.5) |
|---|
| 0.2350037122015945 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the quantile function (inverse CDF) of the logistic distribution. Returns the smallest x such that P(X <= x) >= p.
SELECT dist_logistic_quantile(0.0, 1.0, 0.95);
Output
| dist_logistic_quantile(0.0, 1.0, 0.95) |
|---|
| 2.9444389791664394 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
p
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Computes the complementary quantile function of the logistic distribution. Returns x such that P(X > x) = p, useful for upper tail quantiles.
SELECT dist_logistic_quantile_complement(0.0, 1.0, 0.95);
Output
| dist_logistic_quantile_complement(0.0, 1.0, 0.95) |
|---|
| -2.9444389791664394 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the range of the logistic distribution as [min, max].
SELECT dist_logistic_range(0.0, 1.0);
Output
| dist_logistic_range(0.0, 1.0) |
|---|
| [-inf, inf] |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Generates a random sample from the logistic distribution with the specified parameters.
SELECT dist_logistic_sample(0.0, 1.0);
Output
| dist_logistic_sample(0.0, 1.0) |
|---|
| 1.5447587733716488 |
Related functions
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
n
|
Type
BIGINT
|
Mode Positional | Description |
Description
Generates a list of n random samples from the logistic distribution with the specified parameters.
SELECT dist_logistic_samples(0.0, 1.0, 5);
Output
| dist_logistic_samples(0.0, 1.0, 5) |
|---|
| [-0.8584914840773146, 0.16659885849881398, 1.5516961893630312, 0.1458897633973224, 0.5953286824301555] |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
- dist_logistic_mean() — Returns the mean of the logistic distribution
- dist_logistic_stddev() — Returns the standard deviation of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the skewness of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_skewness(0.0, 1.0);
Output
| dist_logistic_skewness(0.0, 1.0) |
|---|
| 0.0 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the standard deviation of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_stddev(0.0, 1.0);
Output
| dist_logistic_stddev(0.0, 1.0) |
|---|
| 1.8137993642342178 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
- dist_logistic_mean() — Returns the mean of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the support of the logistic distribution as [min, max].
SELECT dist_logistic_support(0.0, 1.0);
Output
| dist_logistic_support(0.0, 1.0) |
|---|
| [-inf, inf] |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
location
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Returns the variance of the logistic distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_logistic_variance(0.0, 1.0);
Output
| dist_logistic_variance(0.0, 1.0) |
|---|
| 3.289868133696453 |
Related functions
- dist_logistic_sample() — Generates a random sample from the logistic distribution with the specified parameters
- dist_logistic_pdf() — Computes the probability density function (PDF) of the logistic distribution at x
- dist_logistic_cdf() — Computes the cumulative distribution function (CDF) of the logistic distribution, P(X <= x)
- dist_logistic_quantile() — Computes the quantile function (inverse CDF) of the logistic distribution