CONFIDENCE.T
The margin of error either side of a sample's mean (confidence 1 - alpha), from Student's t.
Group: Statistics. Compatible with DAX.
Syntax
CONFIDENCE.T ( <alpha>, <standard_dev>, <size> )
| Parameter | Type | Description |
|---|---|---|
alpha | Number | One minus the confidence level, strictly between 0 and 1: 0.05 for a 95 % interval. |
standard_dev | Number | The sample's standard deviation, above 0. |
size | Whole number | How many values are in the sample, 2 or more; rounded to a whole number. |
Returns
Number. The margin either side of the sample's mean, from Student's t with size − 1 degrees of freedom.
Remarks
- It is
T.INV( 1 − alpha / 2, size − 1 ) × standard_dev / √size. - For a few values it is clearly wider than
CONFIDENCE.NORM; the two draw together as the sample grows. - A size below 2 is an error: a single value says nothing about the spread.
Examples
Normal and t margins side by side
EVALUATE
VAR Sizes = DATATABLE ( "Size", INTEGER, { { 5 }, { 30 }, { 200 } } )
RETURN
ADDCOLUMNS (
Sizes,
"Normal", CONFIDENCE.NORM ( 0.05, 2.5, [Size] ),
"Student t", CONFIDENCE.T ( 0.05, 2.5, [Size] )
)
| Size | Normal | Student t |
|---|---|---|
| 5 | 2.19130635144145 | 3.10415999550941 |
| 30 | 0.894597071858579 | 0.933515341895249 |
| 200 | 0.346475956087419 | 0.348595961161408 |
The margin of the mean month
36 months of sales; the margin equals the formula written out with T.INV.
EVALUATE
VAR Monthly = ADDCOLUMNS ( VALUES ( Sales[Month] ), "Liters", [Liters sold] )
VAR n = COUNTROWS ( Monthly )
VAR Spread = STDEVX.S ( Monthly, [Liters] )
RETURN
ROW (
"Margin", CONFIDENCE.T ( 0.05, Spread, n ),
"Written out", T.INV ( 0.975, n - 1 ) * Spread / SQRT ( n )
)
| Margin | Written out |
|---|---|
| 2331.67959533366 | 2331.67959533366 |