T_DIST
Updated 2023-11-05 12:18:38.057000
Syntax
SELECT [westclintech].[wct].[T_DIST](
<@X, float,>
,<@df, float,>
,<@Cumulative, bit,>)
Description
Use the scalar function T_DIST to calculate the probability density function and the left-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.
@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 < @df.
Examples
In this example we calculate the probability density function for x = 8 with 3 degrees of freedom.
SELECT wct.T_DIST( 8, --@X
3, --@df
'False' --@Cumulative
) as pdf;
This produces the following result.
{"columns":[{"field":"pdf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"pdf":"0.000736906520946926"}]}
In this example we calculate the left-tailed cumulative distribution function for x = 60 with 1 degree of freedom.
SELECT wct.T_DIST( 60, --@X
1, --@df
'True' --@Cumulative
) as cdf;
This produces the following result.
{"columns":[{"field":"cdf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"cdf":"0.994695326367377"}]}
The left-tailed cumulative distribution is closely related to the beta distribution.c
SELECT wct.T_DIST(x, df, 'True') as T_DIST,
(1 - wct.BETA_DIST(x * x / (df + x * X), 0.5, df * 0.5, 'True', NULL, NULL)
) * 0.5 as BETA_DIST
FROM
(
VALUES
(-2e-00, 5e-00)
) n (x, df);
This produces the following result.
{"columns":[{"field":"T_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":[{"T_DIST":"0.0509697394149292","BETA_DIST":"0.0509697394149292"}]}