SQL Server T_DIST_RT Function
Updated 2023-11-05 12:21:16.590000
Description
Use the scalar function T_DIST_2T to calculate the right-tailed cumulative probability distribution of Student's t-distribution.
Syntax
SELECT [westclintech].[wct].[T_DIST_RT](
<@X, float,>
,<@df, float,>)
Arguments
@X
the value of interest to be evaluated. @X must be of a type float or of type that intrinsically converts to float.
@df
the number of degrees of freedom. @df must of a type float or of a type that intrinsically converts to float.
Return Type
float
Remarks
0 < @df.
Examples
In this example we calculate the right-tailed cumulative distribution function for x = 60 with 1 degree of freedom.
SELECT wct.T_DIST_RT( 60, --@X
1 --@df
) as T_DIST_RT;
This produces the following result.
| T_DIST_RT |
|---|
| 0.00530467363262321 |
The right-tailed cumulative distribution is closely related to the beta distribution.
SELECT wct.T_DIST_RT(x, df) as T_DIST_RT,
1 - wct.BETA_DIST(1 - x * x / (df + x * X), df * 0.5, 0.5, 'True', NULL,
NULL) * 0.5 as BETA_DIST
FROM
(
VALUES
(-2e-00, 5e-00)
) n (x, df);
This produces the following result.
| T_DIST_RT | BETA_DIST |
|---|---|
| 0.949030260585071 | 0.949030260585071 |