Confidence limits (statistics)

In statistics, a confidence interval (CI) is an interval between two numbers, where there is a certain specified level of confidence that a population parameter lies. Confidence intervals are the most prevalent form of interval estimation.

If U and V are statistics (i.e., observable random variables) whose probability distribution depends on some unobservable parameter &theta;, and


 * $$\Pr(U<\theta<V)=x$$ (where x is a number between 0 and 1)

then the random interval (U, V) is a "(100&middot;x)% confidence interval for &theta;". The number x (or 100&middot;x%) is called the confidence level or confidence coefficient. In modern applied practice, almost all confidence intervals are stated at the 95% level.

Confidence intervals in measurement
More concretely, the results of measurements are often accompanied by confidence intervals. For instance, suppose a scale is known to yield the actual mass of an object plus a normally distributed random error with mean 0 and known standard deviation &sigma;. If we weigh 100 objects of known mass on this scale and report the values ± &sigma;, then we can expect to find that around 68 of the reported ranges include the actual mass. If we report the values ± 2&sigma;, then around 95 of the reported ranges will include the actual mass. If we report ± 3&sigma;, then frequently all 100 of the ranges will include the actual mass, and rarely will more than 1 range miss the actual mass. These intervals are the 68.2%, 95.4%, and 99.7% confidence intervals. The 95.0% confidence interval is ± 1.96&sigma; (use =normsinv(1-(1-0.95)/2) in a spreadsheet).

If we wish to report values with a smaller standard error value, then we repeat the measurement n times and average the results. Then the 68.2% confidence interval is $$\pm \sigma/\sqrt{n}$$. For example, repeating the measurement 100 times reduces the confidence interval to 1/10 of the original width.

Note that when we report a 68.2% confidence interval (usually termed standard error) as v ± &sigma;, this does not mean that the true mass has a 68.2% chance of being in the reported range. In fact, the true mass is either in the range or not. How can a value outside the range be said to have any chance of being in the range? Rather, our statement means that 68.2% of the ranges we report are likely to include the true mass.

This is not just a quibble. Under the incorrect interpretation, each of the 100 measurements described above would be specifying a different range, and the true mass supposedly has a 68% chance of being in each and every range. Also, it supposedly has a 32% chance of being outside each and every range. If two of the ranges happen to be disjoint, the statements are obviously inconsistent. Say one range is 1 to 2, and the other is 2 to 3. Supposedly, the true mass has a 68% chance of being between 1 and 2, but only a 32% chance of being less than 2 or more than 3. The incorrect interpretation reads more into the statement than is meant.

On the other hand, under the correct interpretation, each and every statement we make is really true, because the statements are not about any specific range. We could report that one mass is 10.2 ± 0.1 grams, while really it is 10.6 grams, and not be lying. But if we report fewer than 1000 values and more than two of them are that far off, we will have some explaining to do.

It is also possible to estimate a confidence interval without knowing the standard deviation of the random error. This is done using the T distribution, or by using non-parametric resampling methods such as the bootstrap, which do not require that the error have a normal distribution.

Robust confidence intervals
In the process of weighing 1000 objects, under practical conditions, it is easy to believe that the operator might make a mistake in procedure and so report an incorrect mass (thereby making one type of systematic error). Suppose he has 100 objects and he weighed them all, one at a time, and repeated the whole process ten times. Then he can calculate a sample standard deviation for each object, and look for outliers. Any object with an unusually large standard deviation probably has an outlier in its data. These can be removed by various non-parametric techniques. If he repeated the process only three times, he would simply take the median of the three measurements and use &sigma; to give a confidence interval. The 200 extra weighings served only to detect and correct for operator error and did nothing to improve the confidence interval. With more repetitions, he could use a truncated mean, discarding say the largest and smallest values and averaging the rest. He could then use a bootstrap calculation to determine a confidence interval narrower than that calculated from &sigma;, and so obtain some benefit from a large amount of extra work.

These procedures are robust against procedural errors which are not modeled by the assumption that the balance has a fixed known standard deviation &sigma;. In practical applications where the occasional operator error can occur, or the balance can malfunction, the assumptions behind simple statistical calculations cannot be taken for granted. Before trusting the results of 100 objects weighed just three times each to have confidence intervals calculated from &sigma;, it is necessary to test for and remove a reasonable number of outliers (testing the assumption that the operator is careful and correcting for the fact that he is not perfect), and to test the assumption that the data really have a normal distribution with standard deviation &sigma;.

The theoretical analysis of such an experiment is complicated, but it is easy to set up a spreadsheet which draws random numbers from a normal distribution with standard deviation &sigma; to simulate the situation (use =norminv(rand,0,&sigma;)). See for example Wittwer, J.W., "Monte Carlo Simulation in Excel: A Practical Guide" From Vertex42.com, June 1, 2004, http://vertex42.com/ExcelArticles/mc/. These techniques also work in Open Office and gnumeric.

After removing obvious outliers, one could subtract the median from the other two values for each object, and examine the distribution of the 200 resulting numbers. It should be normal with mean near zero and standard deviation a little larger than &sigma;. A simple Monte Carlo spreadsheet calculation would reveal typical values for the standard deviation (around 105 to 115% of &sigma;). Or, one could subtract the mean of each triplet from the values, and examine the distribution of 300 values. The mean is identically zero, but the standard deviation should be somewhat smaller (around 75 to 85% of &sigma;).

How to understand confidence intervals
Confidence levels are typically given alongside statistics resulting from sampling.

In a statement: we are 95% confident that between 35% and 45% of voters favor Candidate A, 95% is our confidence level and 35%-45% is our confidence interval.

It is very tempting to misunderstand this statement in the following way. We used capital letters U and V for random variables; it is conventional to use lower-case letters u and v for their observed values in a particular instance. The misunderstanding is the conclusion that


 * $$\Pr(u<\theta<v)=0.9,\,$$

so that after the data has been observed, a conditional probability distribution of &theta;, given the data, is inferred. For example, suppose X is normally distributed with expected value &theta; and variance 1. (It is grossly unrealistic to take the variance to be known while the expected value must be inferred from the data, but it makes the example simple.) The random variable X is observable. (The random variable X &minus; &theta; is not observable, since its value depends on &theta;.) Then X &minus; &theta; is normally distributed with expectation 0 and variance 1; therefore


 * $$\Pr(-1.645<X-\theta<1.645)=0.9.\,$$

Consequently


 * $$\Pr(X-1.645<\theta<X+1.645)=0.9,\,$$

so the interval from X &minus; 1.645 to X + 1.645 is a 90% confidence interval for &theta;. But when X = 82 is observed, can we then say that


 * $$\Pr(82-1.645<\theta<82+1.645)=0.9\ \mbox{?}$$

This conclusion does not follow from the laws of probability because &theta; is not a "random variable"; i.e., no probability distribution has been assigned to it. Confidence intervals are generally a frequentist method, i.e., employed by those who interpret "90% probability" as "occurring in 90% of all cases". Suppose, for example, that &theta; is the mass of the planet Neptune, and the randomness in our measurement error means that 90% of the time our statement that the mass is between this number and that number will be correct. The mass is not what is random. Therefore, given that we have measured it to be 82 units, we cannot say that in 90% of all cases, the mass is between 82 &minus; 1.645 and 82 + 1.645. There are no such cases; there is, after all, only one planet Neptune.

But if probabilities are construed as degrees of belief rather than as relative frequencies of occurrence of random events, i.e., if we are Bayesians rather than frequentists, can we then say we are 90% sure that the mass is between 82 &minus; 1.645 and 82 + 1.645? Many answers to this question have been proposed, and are philosophically controversial. The answer will not be a mathematical theorem, but a philosophical tenet. Less controversial are Bayesian credible intervals, in which one starts with a prior probability distribution of &theta;, and finds a posterior probability distribution, which is the conditional probability distribution of &theta; given the data.

For users of frequentist methods, the explanation of a confidence interval can amount to something like: "The confidence interval represents values for the population parameter for which the difference between the parameter and the observed estimate is not statistically significant at the 10% level". Critics of frequentist methods suggest that this hides the real and, to the critics, incomprehensible frequentist interpretation which might be expressed as: "If the population parameter in fact lies within the confidence interval, then the probability that the estimator either will be the estimate actually observed, or will be closer to the parameter, is less than or equal to 90%". Users of Bayesian methods, if they produced a confidence interval, might by contrast say "My degree of belief that the parameter is in fact in the confidence interval is 90%". Disagreements about these issues are not disagreements about solutions to mathematical problems. Rather they are disagreements about the ways in which mathematics is to be applied.

Concrete practical example
Here is one of the most familiar realistic examples. Suppose X1, ..., Xn are an independent sample from a normally distributed population with mean &mu; and variance &sigma;2. Let


 * $$\overline{X}=(X_1+\cdots+X_n)/n,\,$$


 * $$S^2=\frac{1}{n-1}\sum_{i=1}^n\left(X_i-\overline{X}\,\right)^2.$$

Then


 * $$T=\frac{\overline{X}-\mu}{S/\sqrt{n}}$$

has a Student's t-distribution with n &minus; 1 degrees of freedom. Note that what distribution T has does not depend on the values of the unobservable parameters &mu; and &sigma;2; i.e., it is a pivotal quantity. If c is the 95th percentile of this distribution, then


 * $$\Pr\left(-c<T<c\right)=0.9.\,$$

(Note: "95th" and "0.9" are correct in the preceeding expressions. There is a 5% chance that T will be less than -c and a 5% chance that it will be larger than +c. Thus, the probability that T will be between -c and +c is 90%.)

Consequently


 * $$\Pr\left(\overline{X}-cS/\sqrt{n}<\mu<\overline{X}+cS/\sqrt{n}\right)=0.9\,$$

and we have a 90% confidence interval for &mu;.

Confidence intervals for proportions and related quantities
An approximate confidence interval for a population mean can be constructed for random variables that are not normally distributed in the population, relying on the central limit theorem, if the sample sizes and counts are big enough. The formulae are identical to the case above (where the sample mean is actually normally distributed about the population mean). The approximation will be quite good with only a few dozen observations in the sample if the probability distribution of the random variable is not too different from the normal distribution (e.g. its cumulative distribution function does not have any discontinuities and its skewness is moderate).

One type of sample mean is the mean of an indicator variable, which takes on the value 1 for true and the value 0 for false. (Statisticians often call indicator variables "dummy variables", but that term is also frequently used by mathematicians for the concept of a bound variable.) The mean of such a variable is equal to the proportion that have the variable equal to one (both in the population and in any sample). Thus, the sample mean for a variable labeled MALE in data is just the proportion of sampled observations who have MALE = 1, i.e. the proportion who are male. This is a useful property of indicator variables, especially for hypothesis testing.

To apply the central limit theorem, one must use a large enough sample. A rough rule of thumb is that one should see at least 5 cases in which the indicator is 1 and at least 5 in which it is 0. Confidence intervals constructed using the above formulae may include negative numbers or numbers greater than 1, but proportions obviously cannot be negative or exceed 1. The probability assigned to negative numbers and numbers greater than 1 is usually small when the sample size is large and the proportion being estimated is not too close to 0 or 1.

Confidence intervals for cases where the method above assigns a substantial probability to (&minus;&infin;, 0) or to (1, &infin;) may be constructed by inverting hypothesis tests. If we think of conducting hypothesis tests over the whole feasible range of parameter values, and including any values for which a single hypothesis test would not reject the null hypothesis that the true value was that value, given our sample value, we can make a confidence interval based on the central limit theorem that does not violate the basic properties of proportions.

On the other hand, sample proportions can only take on a finite number of values, so the central limit theorem and the normal distribution are not the best tools for building a confidence interval. A better method would rely on the binomial distribution or the beta distribution, and there are a number of better methods in widespread use. For details on advantages and disadvantages of each, see:
 * "Interval Estimation for a Binomial Proportion", Lawrence D. Brown, T. Tony Cai, Anirban DasGupta, Statistical Science, volume 16, number 2 (May, 2001), pages 101-117.