Hypothesis Tests functions in the Stochastic DuckDB extension
Function category
Hypothesis Tests
31 functionsAggregates for Kolmogorov-Smirnov goodness-of-fit, t-tests and Pearson's chi-squared test, returning the statistic and p-value.
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
observed
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
expected
|
Type
DOUBLE
|
Mode Positional | Description |
Description
Pearson's chi-squared goodness-of-fit test with one row per category. Expected values are rescaled to the observed total, so they can be counts or probabilities. Returns the statistic, degrees of freedom (categories - 1) and the p-value.
SELECT chi_squared_test(observed, expected) AS result
FROM (VALUES (18, 0.2), (22, 0.2), (31, 0.3), (29, 0.3)) t(observed, expected);
Output
| result |
|---|
| {'statistic': 0.4666666666666809, 'degrees_of_freedom': 3.0, 'p_value': 0.9261511402759961} |
Related functions
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
min
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
max
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the arcsine distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_arcsine_ks_test(x, 0.0, 1.0) AS ks
FROM (VALUES (0.12), (0.34), (0.27), (0.51), (0.18), (0.42), (0.09), (0.63), (0.31), (0.22)) t(x);
Output
| ks |
|---|
| {'statistic': 0.41627743252839533, 'p_value': 0.06249796055213297} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
alpha
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
beta
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the beta distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_beta_ks_test(x, 2.0, 5.0) AS ks
FROM (VALUES (0.12), (0.34), (0.27), (0.51), (0.18), (0.42), (0.09), (0.63), (0.31), (0.22)) t(x);
Output
| ks |
|---|
| {'statistic': 0.11282817564500014, 'p_value': 0.9995656237430521} |
Related functions
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
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
degrees_of_freedom
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the chi-squared distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_chi_squared_ks_test(x, 5.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.520835969214496, 'p_value': 0.008806589407778226} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
rate
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the exponential distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT round(dist_exponential_ks_test(x, 2.0).p_value, 4) AS p_value
FROM (VALUES (0.1), (0.6), (0.3), (0.05), (1.2), (0.4), (0.2), (0.9)) t(x);
Output
| p_value |
|---|
| 1.0 |
Related functions
- dist_exponential_fit() — Fits a exponential distribution to x by maximum likelihood
- dist_exponential_cdf() — Computes the cumulative distribution function (CDF) of the exponential distribution, P(X <= x)
- dist_exponential_sample() — Generates a random sample from the exponential distribution with the specified parameters
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 extreme value (Gumbel) distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_extreme_value_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.5115448336890416, 'p_value': 0.010668974715049323} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
d1
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
d2
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the Fisher's F distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_fisher_f_ks_test(x, 5.0, 10.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.29944732219125836, 'p_value': 0.3312625185242358} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
shape
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the gamma distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_gamma_ks_test(x, 2.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.16262726620684465, 'p_value': 0.9540753041927538} |
Related functions
- dist_gamma_fit() — Fits a gamma distribution to x by maximum likelihood (Newton's method)
- dist_gamma_cdf() — Computes the cumulative distribution function (CDF) of the gamma distribution, P(X <= x)
- dist_gamma_sample() — Generates a random sample from the gamma distribution with the specified parameters
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
degrees_of_freedom
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the scaled inverse chi-squared distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_inverse_chi_squared_ks_test(x, 5.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.23419937333858387, 'p_value': 0.6430017704099455} |
Related functions
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
shape
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the inverse gamma distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_inverse_gamma_ks_test(x, 3.0, 2.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.42574752602793237, 'p_value': 0.053285509526540493} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
mean
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
shape
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the inverse Gaussian (Wald) distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_inverse_gaussian_ks_test(x, 1.0, 2.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.3868029276988658, 'p_value': 0.10032812573201799} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
sample_size
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the Kolmogorov-Smirnov distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_kolmogorov_smirnov_ks_test(x, 10.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.9184811135877904, 'p_value': 9.409095277317957e-08} |
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 Laplace distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_laplace_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.6648399769821803, 'p_value': 0.00028957485747974884} |
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
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
mean
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
stddev
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the log-normal distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_lognormal_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.2606675826226491, 'p_value': 0.5051542379945657} |
Related functions
- dist_lognormal_fit() — Fits a log-normal distribution to x by maximum likelihood
- dist_lognormal_cdf() — Computes the cumulative distribution function (CDF) of the log-normal distribution, P(X <= x)
- dist_lognormal_sample() — Generates a random sample from the log-normal distribution with the specified parameters
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
alpha
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
beta
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
noncentrality
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the non-central beta distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_non_central_beta_ks_test(x, 2.0, 3.0, 1.0) AS ks
FROM (VALUES (0.12), (0.34), (0.27), (0.51), (0.18), (0.42), (0.09), (0.63), (0.31), (0.22)) t(x);
Output
| ks |
|---|
| {'statistic': 0.3702747826015753, 'p_value': 0.12883938893595392} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
degrees_of_freedom
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
noncentrality
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the non-central chi-squared distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_non_central_chi_squared_ks_test(x, 4.0, 2.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.5808945177821523, 'p_value': 0.002344644150378174} |
Related functions
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
d1
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
d2
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
noncentrality
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the non-central F distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_non_central_f_ks_test(x, 5.0, 10.0, 2.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.15463195317398948, 'p_value': 0.9705537878269356} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
degrees_of_freedom
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
noncentrality
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the non-central Student's t distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_non_central_t_ks_test(x, 10.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.27688821529635366, 'p_value': 0.42729006642351897} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
mean
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
stddev
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the normal distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_normal_ks_test(x, 0.0, 1.0) AS ks
FROM (VALUES (-1.2), (0.3), (0.8), (-0.4), (1.9), (0.1), (-0.7), (0.5)) t(x);
Output
| ks |
|---|
| {'statistic': 0.164827837277029, 'p_value': 0.9815767356290033} |
Related functions
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
shape
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the Pareto distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_pareto_ks_test(x, 1.0, 3.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.3285322359396433, 'p_value': 0.23060187850681535} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the Rayleigh distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_rayleigh_ks_test(x, 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.3110783825406137, 'p_value': 0.2878656925455899} |
Related functions
- dist_rayleigh_fit() — Fits a Rayleigh distribution to x by maximum likelihood
- dist_rayleigh_cdf() — Computes the cumulative distribution function (CDF) of the Rayleigh distribution, P(X <= x)
- dist_rayleigh_sample() — Generates a random sample from the Rayleigh distribution with the specified parameters
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 |
Argument
shape
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the skew normal distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_skew_normal_ks_test(x, 0.0, 1.0, 4.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.4318846771995842, 'p_value': 0.047961623466389075} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
degrees_of_freedom
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the Student's t distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_students_t_ks_test(x, 10.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.6512162951704386, 'p_value': 0.0004144716085637138} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
lower
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
mode
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
upper
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the triangular distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_triangular_ks_test(x, 0.0, 0.5, 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.78, 'p_value': 1.0388066948005695e-05} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
min
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
max
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the continuous uniform distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_uniform_real_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.7, 'p_value': 0.00011090319886433517} |
Related functions
- dist_uniform_real_fit() — Fits a continuous uniform distribution to x by maximum likelihood (the sample minimum and maximum)
- dist_uniform_real_cdf() — Computes the cumulative distribution function (CDF) of the continuous uniform distribution, P(X <= x)
- dist_uniform_real_sample() — Generates a random sample from the continuous uniform distribution with the specified parameters
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
shape
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
scale
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample Kolmogorov-Smirnov test of whether x follows the Weibull distribution with the given parameters. Returns the statistic D and the asymptotic p-value.
SELECT dist_weibull_ks_test(x, 1.5, 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.4106284978663306, 'p_value': 0.06861744510567767} |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
mu
|
Type
DOUBLE
|
Mode Positional | Description |
Description
One-sample t-test of whether the mean of x equals mu. Returns the t statistic, degrees of freedom and the two-sided p-value.
SELECT one_sample_t_test(x, 5.0) AS result
FROM (VALUES (5.1), (4.8), (5.6), (5.0), (5.4), (5.3)) t(x);
Output
| result |
|---|
| {'t_statistic': 1.6903085094570263, 'degrees_of_freedom': 5.0, 'p_value': 0.15176111049909943} |
Related functions
- chi_squared_test() — Pearson's chi-squared goodness-of-fit test with one row per category
- student_t_test() — Student's two-sample t-test with pooled variance of whether two independent samples have the same mean
- welch_t_test() — Welch's unequal-variance t-test of whether two independent samples have the same mean
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
sample_index
|
Type
BIGINT
|
Mode Positional | Description |
Description
Student's two-sample t-test with pooled variance of whether two independent samples have the same mean. sample_index (0 or 1) assigns each row to a sample. Returns the t statistic, degrees of freedom and the two-sided p-value.
SELECT student_t_test(x, grp).p_value AS p_value
FROM (VALUES (5.1, 0), (4.8, 0), (5.6, 0), (5.0, 0), (6.2, 1), (5.9, 1), (7.1, 1), (6.4, 1)) t(x, grp);
Output
| p_value |
|---|
| 0.005947625666406391 |
Signature
Arguments (Positional)
| Argument | Type | Mode | Description |
|---|---|---|---|
Argument
x
|
Type
DOUBLE
|
Mode Positional | Description |
Argument
sample_index
|
Type
BIGINT
|
Mode Positional | Description |
Description
Welch's unequal-variance t-test of whether two independent samples have the same mean. sample_index (0 or 1) assigns each row to a sample. Returns the t statistic, Welch-Satterthwaite degrees of freedom and the two-sided p-value.
SELECT welch_t_test(x, grp) AS result
FROM (VALUES (5.1, 0), (4.8, 0), (5.6, 0), (5.0, 0), (6.2, 1), (5.9, 1), (7.1, 1), (6.4, 1)) t(x, grp);
Output
| result |
|---|
| {'t_statistic': -4.1595134458768355, 'degrees_of_freedom': 5.230386148373551, 'p_value': 0.008012385831038592} |