# SQL Server T.DIST function

T_DIST

Updated: 31 July 2015

Use T_DIST to calculate the probability density function and the left-tailed cumulative probability distribution of Student's t-distribution.
Syntax
SELECT [wct].[T_DIST](
<@X, float,>
,<@df, float,>
,<@Cumulative, bit,>)
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.
@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

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.

The left-tailed cumulative distribution is closely related to the beta distribution.
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.