CONFIDENCE_T
Updated 2023-11-02 21:25:25.513000
Syntax
SELECT [westclintech].[wct].[CONFIDENCE_T](
<@Alpha, float,>
,<@Standard_dev, float,>
,<@Size, float,>)
Description
Use the scalar function CONFIDENCE_T to calculate a confidence interval when you don't know the population standard deviation and are using the sample standard deviation instead.
Arguments
@Alpha
The significance level used to calculate the confidence interval. @Alpha must be of a type float or of type that intrinsically converts to float.
@Size
The sample size. @Size must be of a type float or of a type the intrinsically converts to float.
@Standard_dev
The sample standard deviation. @Standard_dev must be of a type float or of a type that intrinsically converts to float.
Return Type
float
Remarks
0 < @Alpha < 1.
0 < Standard_dev.
0 < @Size.
Examples
Given a sample standard deviation of 14.67, calculate the 95% confidence interval for a sample size of 50.
SELECT wct.CONFIDENCE_T( .05, --@Alpha
14.67, --@Standard_dev
50 --@Size
) as CI;
This produces the following result.
{"columns":[{"field":"CI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"CI":"4.16916787012236"}]}
The CONFIDENCE_T function is closely related to the T_INV function.
SELECT wct.CONFIDENCE_T(alpha, mu, sigma) as CI,
wct.T_INV(1 - alpha * 0.5, sigma - 1) * mu / SQRT(sigma) as CI
FROM
(
VALUES
(0.05, 14.67, 50)
) n (alpha, mu, sigma);
This produces the following result.
{"columns":[{"field":"CI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"CI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"CI":"4.16916787012236"}]}
See Also
CONFIDENCE_NORM - Confidence interval using the standard normal distribution