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 number of digits to use; if not supplied,
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.
model is given, then
ci is ignored, and a confidence
interval is calculated using
level set to
level corresponds to a range of plus or minus one
standard deviation, for the t distribution and a large number of degrees of
qt(0.6914619, 100000) is 0.5).
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
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
+/- notation, e.g. \(a \pm 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 \(\pm\) notation be avoided altogether.
parentheses notation is often called the compact notation. In
it, the digits in parentheses 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 \(\pm\) 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 \(\pm\) notation,
while JCM (2008, section 7.2.2 on pages 25 and 26) suggest halving the
number put in parentheses.
foramtci function is based on the JCM (2008) notation, i.e.
formatCI(ci=c(8,12), style="+/-") yields
formatCI(ci=c(8,12), style="parentheses") yields
Note: if the confidence range exceeds the value, the
parentheses format reverts to
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,
http://www.bipm.org/en/publications/guides/gum.html (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