Updated: 31 July 2015

Use CHISQ_DIST to calculate the probability density or the lower cumulative probability of a chi-squared distribution for x and a number of degrees of freedom.

SELECT [wct].[CHISQ_DIST](

<@X, float,>

,<@Degrees_freedom, float,>

,<@Cumulative, bit,>)

The value of interest to be evaluated. *@X* must be of a type **float** or of type that intrinsically converts to **float**.

The number of degrees freedom. *@Degrees_freedom* must be of a type **float** or of a type that intrinsically converts to **float**.

A **bit** value indicating whether the probability density function ('False') or the cumulative distribution function ('True') should be returned.

float

· 0 < *@X*

· 0 < *@Degrees_freedom*

In this example we calculate the chi-squared lower-tailed cumulative distribution function.

SELECT

wct.CHISQ_DIST(

0.5 --@X

,1 --@Degrees_freedom

,'True' --@Cumulative

) as CDF

This produces the following result

Using the same data we calculate the chi-squared probability distribution function.

SELECT

wct.CHISQ_DIST(

0.5 --@X

,1 --@Degrees_freedom

,'False' --@Cumulative

) as PDF

This produces the following result.

The chi-squared distribution is a special case of the gamma distribution

SELECT

wct.CHISQ_DIST(x,df,'True') as [Chi-squared]

,wct.GAMMAP(0.5*df,0.5*x) as GammaP

FROM (VALUES (42,57))n(x,df)

This produces the following result.