SQL Server STUDENTST Function
Updated 2024-03-13 13:39:32.120000
Description
Use STUDENTST to calculate Student's t -distribution. The formula is:
f(t) = \frac{ 1 }{\ \sqrt{\nu\ }\ {\mathrm B}\left( \frac{\ 1\ }{ 2 },\ \frac{\ \nu\ }{ 2 }\right)\ } \ \left(\ 1 + \frac{\ t^2\ }{ \nu }\ \right)^{-(\nu+1)/2}\
Where
| column 1 | column 2 |
|---|---|
| t | is a random variable |
| ν | is the degrees of freedom |
| B | is the Beta function |
Syntax
SELECT [westclintech].[wct].[STUDENTST] (
<@X, float,>
,<@Degrees_freedom, float,>
,<@Cumulative, bit,>)
Arguments
@X
is the value supplied to the distribution. @X is an expression of type float or of a type that can be implicitly converted to float.
@Degrees_freedom
is a number specifying the degrees of freedom. @Degrees_freedom is an expression of type float or of a type that can be implicitly converted to float.
@Cumulative
identifies the distribution calculation as being either the cumulative distribution function or the probability density function. @Cumulative is an expression of type bit or of a type that can be implicitly converted to bit.
Return Type
float
Remarks
If @Degrees_freedom < 1 the function returns an error.
If @X < 0 the function returns an error.
@Degrees_freedom is truncated to zero decimal places.
Specify the cumulative distribution function by entering 'True' or 1 in @Cumulative.
Specify the probability density function by entering 'False' or 0 in @Cumulative.
Examples
To calculate the probability density function (pdf)
SELECT wct.STUDENTST(1, 2, 'False');
This produces the following result.
| column 1 |
|---|
| 0.192450089729875 |
This may also be entered as:
SELECT wct.STUDENTST(1, 2, 0);
To calculate the cumulative distribution function (cdf):
SELECT wct.STUDENTST(1, 2, 'True');
This produces the following result.
| column 1 |
|---|
| 0.788675134594813 |
This may also be entered as
SELECT wct.STUDENTST(1, 2, 1);