Logo

F_DIST

Updated 2023-11-02 21:40:00.070000

Syntax

SELECT [westclintech].[wct].[F_DIST](
  <@x, float,>
 ,<@df1, float,>
 ,<@df2, float,>
 ,<@Cumulative, bit,>)

Description

Use the scalar function F_DIST to calculate the probability density or the lower cumulative probability of an F-distribution for x and degrees of freedom for 2 independent random variables.

Arguments

@df1

The number of degrees freedom for the numerator random variable. @df1 must be of a type float or of a type that intrinsically converts to float.

@X

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

@df2

The number of degrees freedom for the denominator random variable. @df2 must be of a type float or of a type that intrinsically converts to float.

@Cumulative

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

Return Type

float

Remarks

0 < @X.

0 < @df1.

0 < @df2.

Examples

In this example we calculate the F cumulative distribution function for x = 9 with 4 numerator degrees of freedom and 5 denominator degrees of freedom.

SELECT wct.F_DIST(   9,     --@x

                     4,     --@df1

                     5,     --@df2

                     'True' --@Cumulative

                 ) CDF;

This produces the following result.

{"columns":[{"field":"CDF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"CDF":"0.983405934195344"}]}

Using the same data we calculate the F probability distribution function.

SELECT wct.F_DIST(   9,      --@x

                     4,      --@df1

                     5,      --@df2

                     'False' --@Cumulative

                 ) PDF;

This produces the following result.

{"columns":[{"field":"PDF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"PDF":"0.0038928547596102"}]}

The F distribution is closely related to the beta distribution.

SELECT wct.F_DIST(x, df1, df2, 'True') as F_DIST,

       wct.BETA_DIST(df1 * x / (df2 + df1 * x), df1 / 2, df2 / 2, 'True', NULL, 

                 NULL) as BETA_DIST

FROM

(

    VALUES

        (0.95, 6e-00, 11e-00)

) n (x, df1, df2);

This produces the following result.

{"columns":[{"field":"F_DIST","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"BETA_DIST","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"F_DIST":"0.500921050057676","BETA_DIST":"0.500921050057676"}]}

See Also

BETA_DIST - Calculate pdf or cdf of beta distribution

F_DIST_RT - Upper F distribution

F_INV - Inverse of the lower-tailed F distribution

F_INV_RT - Calculate the inverse of the F upper probability distribution.