NCFPDF
Updated 2024-03-11 15:16:37.470000
Syntax
SELECT [westclintech].[wct].[NCFPDF] (
<@X, float,>
,<@DF1, float,>
,<@DF2, float,>
,<@Lambda, float,>)
Description
Use the scalar function NCFPDF to calculate the probability density function of the non-central F distribution.
The formula for the probability density function is:
f(x,v_1,v_2,\lambda) =\sum\limits_{k=0}^\infty\frac{e^{-\lambda/2}(\lambda/2)^k}{ B\left(\frac{\nu_2}{2},\frac{\nu_1}{2}+k\right) k!} \left(\frac{\nu_1}{\nu_2}\right)^{\frac{\nu_1}{2}+k} \left(\frac{\nu_2}{\nu_2+\nu_1x}\right)^{\frac{\nu_1+\nu_2}{2}+k}x^{\nu_1/2-1+k}
where x is greater than zero, the degrees of freedom ν1 and ν2 are positive and B is the beta function.
Arguments
@DF1
degrees of freedom. @DF1 is an expression of type float or of a type that implicitly converts to float.
@X
is the variable to be evaluated. @X is an expression of type float or of a type that implicitly converts to float.
@DF2
degrees of freedom. @DF2 is an expression of type float or of a type that implicitly converts to float.
@Lambda
is the non-centrality parameter. @Lambda is an expression of type float or of a type that implicitly converts to float.
Return Type
float
Remarks
@X must be greater than zero (@X > 0).
@DF1 must be greater than zero (@DF1 > 0).
@DF2 must be greater than zero (@DF2 > 0).
@Lambda must be greater than or equal to zero (@Lambda > 0).
Examples
Calculate the probability density function:
SELECT wct.NCFPDF(0.5, 3, 2, 1);
This produces the following result.
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"0.413072076061936"}]}
You can use the SeriesFloat function from the XLeratorDB/math library to generate a dataset which can be pasted into EXCEL to generate a graph of the cumulative distribution function.
SELECT SeriesValue,
wct.NCFPDF(SeriesValue, 1, 1, 1) as [f(x,1,1,1)],
wct.NCFPDF(SeriesValue, 1, 2, 1) as [f(x,1,2,1)],
wct.NCFPDF(SeriesValue, 2, 1, 2) as [f(x,2,1,2)],
wct.NCFPDF(SeriesValue, 2, 2, 1) as [f(x,2,2,1)],
wct.NCFPDF(SeriesValue, 3, 1, 2) as [f(x,3,1,2)]
FROM wct.SeriesFloat(.1, 10, .1, NULL, NULL);
This is an EXCEL-generated graph of the results.