CHISQPDF
Updated 2024-03-07 21:16:40.027000
Syntax
SELECT [westclintech].[wct].[CHISQPDF] (
<@X, float,>
,<@Degrees_freedom, float,>)
Description
Use the scalar function CHISQPDF to calculate the probability density function of the chi square distribution.
The probability density function is:
f\left(x,v\right)=\frac{x^{v^2-1}e^{-\frac{x}{2}}}{2^\frac{v}{2}\Gamma\left(\frac{v}{2}\right)}
Arguments
@Degrees_Freedom
is the degrees of freedom. @Degrees_Freedom is an expression of type float or of a type that implicitly converts to float.
@X
is any real number. @X is an expression of type float or of a type that implicitly converts to float.
Return Type
float
Remarks
@DF must be greater than zero (@DF > 0).
Examples
SELECT wct.CHISQPDF(1, 3) as [CHISQ pdf];
This produces the following result.
{"columns":[{"field":"CHISQ pdf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"CHISQ pdf":"0.241970724519143"}]}
You can use the SreiesFloat function from the XLeratorDB/math library to generate a dataset which can be pasted into EXCEL to generate a graph of the function.
SELECT SeriesValue,
wct.CHISQPDF(SeriesValue, 1) as [f(x,1)],
wct.CHISQPDF(SeriesValue, 3) as [f(x,3)],
wct.CHISQPDF(SeriesValue, 4) as [f(x,5)],
wct.CHISQPDF(SeriesValue, 7) as [f(x,7)],
wct.CHISQPDF(SeriesValue, 9) as [f(x,9)]
FROM wct.SeriesFloat(0.1, 20, .1, NULL, NULL);
This is an EXCEL-generated graph of the results