Confidence interval in parenthetic notation


Format a confidence interval in parenthetic notation.


formatCI(ci, style = c("+/-", "parentheses"), model, digits = NULL)



optional vector of length 2 or 3.


string indicating notation to be used.


optional regression model, e.g. returned by lm or nls.


optional number of digits to use; if not supplied, getOption("digits") is used.


If a model is given, then ci is ignored, and a confidence interval is calculated using confint with level set to 0.6914619. This level corresponds to a range of plus or minus one standard deviation, for the t distribution and a large number of degrees of freedom (since qt(0.6914619, 100000) is 0.5).

If model is missing, ci must be provided. If it contains 3 elements, then first and third elements are taken as the range of the confidence interval (which by convention should use the level stated in the previous paragraph), and the second element is taken as the central value. Alternatively, if ci has 2 elements, they are taken to be bounds of the confidence interval and their mean is taken to be the central value.

In the +/- notation, e.g. a +/- b means that the true value lies between a-b and a+b with a high degree of certainty. Mills et al. (1993, section 4.1 on page 83) suggest that b should be set equal to 2 times the standard uncertainty or standard deviation. JCGM (2008, section 7.2.2 on pages 25 and 26), however, suggest that b should be set to the standard uncertainty, while also recommending that the +/- notation be avoided altogether.

The parentheses notation is often called the compact notation. In it, the digits in parenthese indicate the uncertainty in the corresponding digits to their left, e.g. 12.34(3) means that the last digit (4) has an uncertainty of 3. However, as with the +/- notation, different authorities offer different advice on defining this uncertainty; Mills et al. (1993, section 4.1 on page 83) provide an example in which the parenthetic notation has the same value as the +/- notation, while JCM (2008, section 7.2.2 on pages 25 and 26) suggest halving the number put in parentheses.

The foramtci function is based on the JCM (2008) notation, i.e. formatCI(ci=c(8,12), style="+/-") yields "10+-2", and formatCI(ci=c(8,12), style="parentheses") yields "10(2)".

Note: if the confidence range exceeds the value, the parentheses format reverts to +/- format.


If ci is given, the result is a character string with the estimate and its uncertainty, in plus/minus or parenthetic notation. If model is given, the result is a 1-column matrix holding character strings, with row names corresponding to the parameters of the model.


Dan Kelley


JCGM, 2008. Evaluation of measurement data - Guide to the expression of uncertainty in measurement (JCGM 100:2008), published by the Joint Committee for Guides in Metrology. [] (See section 7.2.2 for a summary of notation, which shows equal values to the right of a +- sign and in parentheses.)

I. Mills, T. Cvitas, K. Homann, N. Kallay, and K. Kuchitsu, 1993. Quantities, Units and Symbols in Physical Chemistry, published Blackwell Science for the International Union of Pure and Applied Chemistry. (See section 4.1, page 83, for a summary of notation, which shows that a value to the right of a +- sign is to be halved if put in


x <- seq(0, 1, length.out=300)
y <- rnorm(n=300, mean=10, sd=1) * x
m <- lm(y~x)

Questions? Problems? Suggestions? or email at

All documentation is copyright its authors; we didn't write any of that.