CHISQ_DIST_RT
Updated 2023-11-02 21:07:45.413000
Syntax
SELECT [westclintech].[wct].[CHISQ_DIST_RT](
<@X, float,>
,<@Degrees_freedom, float,>)
Description
Use the scalar function CHISQ_DIST_RT to calculate the upper distribution of a chi-squared distribution for x and a number of degrees of freedom.
Arguments
@X
The value of interest to be evaluated. @X must be of a type float or of type that intrinsically converts to float.
@Degrees_freedom
The number of degrees freedom. @Degrees_freedom must be of a type float or of a type that intrinsically converts to float.
Return Type
float
Remarks
0 < @X.
0 < @Degrees_freedom.
Examples
In this example we calculate the right-tailed probability.
SELECT wct.CHISQ_DIST_RT( 0.5, --@X
1 --@Degrees_freedom
) as [Right Tail];
This produces the following result.
{"columns":[{"field":"Right Tail","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Right Tail":"0.479500122186953"}]}
The chi-squared distribution is a special case of the gamma distribution.
SELECT wct.CHISQ_DIST_RT(x, df) as [Chi-squared],
wct.GAMMAQ(0.5 * df, 0.5 * x) as GammaQ
FROM
(
VALUES
(42, 57)
) n (x, df);
This produces the following result.
{"columns":[{"field":"Chi-squared","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"GammaQ","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Chi-squared":"0.931544160954818","GammaQ":"0.931544160954818"}]}
See Also
CHISQ_DIST - Lower chi-squared distribution
CHISQ_INV - Inverse of the chi-squared distribution
CHISQ_INV_RT - Calculate the inverse of the right-tailed probability of a chi-squared distribution.