Cauchy functions in the Stochastic DuckDB extension
Function category
Cauchy
24 functionsCauchy distribution — heavy-tailed location/scale family with no defined mean. Used in robust statistics and physics.
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 Cauchy distribution, P(X <= x).
SELECT dist_cauchy_cdf(0.0, 1.0, 0.5);
Output
| dist_cauchy_cdf(0.0, 1.0, 0.5) |
|---|
| 0.6475836176504333 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution, P(X > x).
SELECT dist_cauchy_cdf_complement(0.0, 1.0, 0.5);
Output
| dist_cauchy_cdf_complement(0.0, 1.0, 0.5) |
|---|
| 0.35241638234956674 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution at x.
SELECT dist_cauchy_chf(0.0, 1.0, 0.5);
Output
| dist_cauchy_chf(0.0, 1.0, 0.5) |
|---|
| 1.0429418980620317 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Fits a Cauchy 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 dist_cauchy_fit(x) AS fit
FROM (VALUES (0.2), (-0.5), (1.1), (0.4), (-0.1), (45.0), (0.7), (0.0)) t(x);
Output
| fit |
|---|
| {'location': 0.18918092986005372, 'scale': 0.3911158749331699, 'log_likelihood': -16.299967470868125, 'aic': 36.59993494173625, 'bic': 36.75881802509592} |
Related functions
- dist_cauchy_ks_test() — One-sample Kolmogorov-Smirnov test of whether x follows the Cauchy distribution with the given parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_sample() — Generates a random sample from the Cauchy 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 Cauchy distribution at x.
SELECT dist_cauchy_hazard(0.0, 1.0, 0.5);
Output
| dist_cauchy_hazard(0.0, 1.0, 0.5) |
|---|
| 0.7225768202070803 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_cauchy_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.6211189415908434, 'p_value': 0.0008914799495648358} |
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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_kurtosis(0.0, 1.0);
Output
| dist_cauchy_kurtosis(0.0, 1.0) |
|---|
| NULL |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
- dist_cauchy_mean() — Returns the mean of the Cauchy distribution
- dist_cauchy_stddev() — Returns the standard deviation of the Cauchy 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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_kurtosis_excess(0.0, 1.0);
Output
| dist_cauchy_kurtosis_excess(0.0, 1.0) |
|---|
| NULL |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
- dist_cauchy_mean() — Returns the mean of the Cauchy distribution
- dist_cauchy_stddev() — Returns the standard deviation of the Cauchy 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 Cauchy distribution.
SELECT dist_cauchy_log_cdf(0.0, 1.0, 0.5);
Output
| dist_cauchy_log_cdf(0.0, 1.0, 0.5) |
|---|
| -0.4345073545177282 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution, log P(X > x).
SELECT dist_cauchy_log_cdf_complement(0.0, 1.0, 0.5);
Output
| dist_cauchy_log_cdf_complement(0.0, 1.0, 0.5) |
|---|
| -1.0429418980620317 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution at x. Useful for numerical stability when dealing with very small probabilities.
SELECT dist_cauchy_log_pdf(0.0, 1.0, 0.5);
Output
| dist_cauchy_log_pdf(0.0, 1.0, 0.5) |
|---|
| -1.3678734371636099 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_mean(0.0, 1.0) AS mean, dist_cauchy_median(0.0, 1.0) AS median;
Output
| mean | median |
|---|---|
| NULL | 0.0 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
- dist_cauchy_stddev() — Returns the standard deviation of the Cauchy 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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_median(0.0, 1.0);
Output
| dist_cauchy_median(0.0, 1.0) |
|---|
| 0.0 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_mode(0.0, 1.0);
Output
| dist_cauchy_mode(0.0, 1.0) |
|---|
| 0.0 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution at x.
SELECT dist_cauchy_pdf(0.0, 1.0, 0.5);
Output
| dist_cauchy_pdf(0.0, 1.0, 0.5) |
|---|
| 0.25464790894703254 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution. Returns the smallest x such that P(X <= x) >= p.
SELECT dist_cauchy_quantile(0.0, 1.0, 0.95);
Output
| dist_cauchy_quantile(0.0, 1.0, 0.95) |
|---|
| 6.313751514675038 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy 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 Cauchy distribution. Returns x such that P(X > x) = p, useful for upper tail quantiles.
SELECT dist_cauchy_quantile_complement(0.0, 1.0, 0.95);
Output
| dist_cauchy_quantile_complement(0.0, 1.0, 0.95) |
|---|
| -6.313751514675038 |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution as [min, max].
SELECT dist_cauchy_range(0.0, 1.0);
Output
| dist_cauchy_range(0.0, 1.0) |
|---|
| [-inf, inf] |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution with the specified parameters.
SELECT dist_cauchy_sample(0.0, 1.0);
Output
| dist_cauchy_sample(0.0, 1.0) |
|---|
| -1.428914573095852 |
Related functions
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution with the specified parameters.
SELECT dist_cauchy_samples(0.0, 1.0, 5);
Output
| dist_cauchy_samples(0.0, 1.0, 5) |
|---|
| [-0.9965739161126204, -2.533554139354837, -0.685869838220868, -2.222377361765304, -3.5619252081927906] |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
- dist_cauchy_mean() — Returns the mean of the Cauchy distribution
- dist_cauchy_stddev() — Returns the standard deviation of the Cauchy 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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_skewness(0.0, 1.0);
Output
| dist_cauchy_skewness(0.0, 1.0) |
|---|
| NULL |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
- dist_cauchy_mean() — Returns the mean of the Cauchy distribution
- dist_cauchy_stddev() — Returns the standard deviation of the Cauchy 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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_stddev(0.0, 1.0);
Output
| dist_cauchy_stddev(0.0, 1.0) |
|---|
| NULL |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
- dist_cauchy_mean() — Returns the mean of the Cauchy 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 Cauchy distribution as [min, max].
SELECT dist_cauchy_support(0.0, 1.0);
Output
| dist_cauchy_support(0.0, 1.0) |
|---|
| [-inf, inf] |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_cdf() — Computes the cumulative distribution function (CDF) of the Cauchy distribution, P(X <= x)
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy 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 Cauchy distribution. Returns NULL when it is undefined for the given parameters.
SELECT dist_cauchy_variance(0.0, 1.0);
Output
| dist_cauchy_variance(0.0, 1.0) |
|---|
| NULL |
Related functions
- dist_cauchy_sample() — Generates a random sample from the Cauchy distribution with the specified parameters
- dist_cauchy_pdf() — Computes the probability density function (PDF) of the Cauchy distribution at x
- dist_cauchy_quantile() — Computes the quantile function (inverse CDF) of the Cauchy distribution
- dist_cauchy_mean() — Returns the mean of the Cauchy distribution
- dist_cauchy_stddev() — Returns the standard deviation of the Cauchy distribution