Logo

CHIDIST

Updated 2024-03-07 21:13:00.737000

Syntax

SELECT [westclintech].[wct].[CHIDIST] (
  <@X, float,>
 ,<@Degrees_freedom, float,>)

Description

Use the scalar function CHIDIST to calculate the one-tailed probability of the chi-square distribution. The chi-square distribution is associated with a chi-squared result. The chi-square distribution is a special case of the gamma distribution. Its cumulative distribution function is:

\text{F}\left(x;k\right)=\frac{\gamma(k\slash2,x\slash2)}{\Gamma(k\slash2)}

Where γ(s,t) is the lower incomplete gamma function.

Arguments

@X

is any real positive number. @X is an expression of type float or of a type that can be implicitly converted to float.

@Degrees_freedom

is any real positive number. @Degrees_freedom is an expression of type float or of a type that can be implicitly converted to float.

Return Type

float

Remarks

If @X < 0, CHIDIST returns an error.

@Degrees_freedom is truncated to zero decimal places

if @Degrees_freedom < 1 or @Degrees_freedom > 10^10, CHIDIST returns an error.

CHIDIST = 1-GAMMADIST(@X,@Degrees_freedom/2,2,'True')

Examples

select wct.CHIDIST(15.0862724691398, 5);

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.0100000000000011"}]}
select 1 - wct.GAMMADIST(15.0862724691398, 2.5, 2, 'True');

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.0100000000000011"}]}