Logo

T_DIST_2T

Updated 2023-11-05 12:20:05.027000

Syntax

SELECT [westclintech].[wct].[T_DIST_2T](
  <@X, float,>
 ,<@df, float,>)

Description

Use the scalar function T_DIST_2T to calculate the two-tailed cumulative probability distribution of Student's t-distribution.

Arguments

@df

the number of degrees of freedom. @df must 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.

Return Type

float

Remarks

0 < @df.

Examples

In this example we calculate the two-tailed cumulative distribution function for x = 60 with 1 degree of freedom.

SELECT wct.T_DIST_2T(   60, --@X

                        1   --@df

                    ) as T_DIST_2T;

This produces the following result.

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

The two-tailed cumulative distribution is closely related to the beta distribution.

SELECT wct.T_DIST_2T(x, df) as T_DIST_2T,

       1 - wct.BETA_DIST(x * x / (df + x * X), 0.5, df * 0.5, 'True', NULL, NULL)

                 as BETA_DIST

FROM

(

    VALUES

        (-2e-00, 5e-00)

) n (x, df);

This produces the following result.

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