How to Display Confidence Intervals with siunitx
At a glance
- 1. Choose the format
For an interval, decide whether to show its lower and upper bounds or an estimate with a margin of uncertainty.
- 2. Format each number
Use siunitx commands such as num for the estimate and each confidence-interval endpoint.
- 3. Label the interval
Add the confidence level and explicit brackets so readers know the bounds form a confidence interval.
- 4. Check the meaning
Parenthesized uncertainty notation is not automatically a confidence interval; state the interval and level clearly.
The siunitx package can format the numbers in a confidence interval, but it does not decide or communicate the statistical meaning of the interval for you. The clearest approach is to format the estimate and both endpoints with \num, then write the brackets and confidence level explicitly.
Format the endpoints explicitly
For an estimate of 0.53 with a 95% confidence interval from 0.41 to 0.65, write the interval as [0.41, 0.65] and label it as a 95% CI. A complete minimal document is:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
The estimated proportion was \num{0.53}
(95\% CI: $[\num{0.41},\,\num{0.65}]$).
\end{document}
The \num{...} command applies siunitx number formatting to each value. The brackets and comma are written explicitly because they show the reader that the two numbers are the lower and upper bounds. The confidence level is ordinary text; it is not inferred from the numbers.
If you prefer a range written with a word or dash between its endpoints, siunitx also provides \numrange{0.41}{0.65}. Its range separator is controlled by the package’s range settings. Use explicit brackets instead when you want the conventional interval notation [lower, upper].
Put intervals in a table
For a table, one practical layout is to use an S column for the estimate and a regular text column for the interval. This keeps the estimate aligned numerically while letting you show the interval in familiar bracket notation:
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{l S[table-format=1.2] l}
Group & {Estimate} & {95\% confidence interval} \\
A & 0.53 & $[\num{0.41},\,\num{0.65}]$ \\
B & 0.68 & $[\num{0.57},\,\num{0.78}]$ \\
\end{tabular}
\end{document}
The S column is designed for numbers and aligns the estimates by their decimal markers. The header is enclosed in braces so that siunitx treats it as text rather than as a number to parse. The interval column uses ordinary left alignment; each endpoint is still formatted with \num.
If you need the endpoints in separately aligned columns, make two S columns and put labels such as “Lower” and “Upper” above them. That can be useful in dense tables, but include enough context to make clear that those columns are interval bounds and specify the confidence level.
Do not confuse confidence intervals with uncertainty notation
siunitx can also parse parenthesized uncertainty notation. For example, \num{1.234(56)} represents a value of 1.234 with an uncertainty of 0.056 in the final digits. That notation is common for measurement uncertainty, but it does not by itself mean “95% confidence interval.”
A symmetric confidence interval may have the same numerical endpoints as an estimate plus or minus a margin. Even then, writing the endpoints and confidence level explicitly avoids ambiguity about what the margin represents. For an asymmetric interval, a single parenthesized uncertainty is especially unsuitable because the distances from the estimate to the two bounds differ.
Common mistakes
- Omitting the confidence level:
[0.41, 0.65]gives bounds but does not say whether the interval is, for example, a 90% or 95% CI. - Using
\pmwithout checking symmetry: An estimate and a single margin only convey both endpoints when the interval is symmetric. - Treating parentheses as a CI label:
\num{0.53(12)}does not tell the reader that the interval has a particular confidence level. - Rounding the endpoints inconsistently: Round the estimate and bounds sensibly for the analysis, and avoid implying more precision than the data support. Formatting a number cannot correct an inappropriate statistical interval.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.