Confidence interval#Statistical hypothesis testing

{{Short description|Range to estimate an unknown parameter}}

{{Expert needed|statistics|date=April 2025|reason= This article may be too technical for most readers to understand

}}

File:Normal distribution 50% CI illustration.svg

In statistics, a confidence interval (CI) is a range of values used to estimate an unknown statistical parameter, such as a population mean.{{cite journal | doi=10.21037/jtd.2017.09.14 | doi-access=free | title=Using the confidence interval confidently | date=2017 | last1=Hazra | first1=Avijit | journal=Journal of Thoracic Disease | volume=9 | issue=10 | pages=4124–4129 | pmid=29268424 | pmc=5723800 }} Rather than reporting a single point estimate (e.g. "the average screen time is 3 hours per day"), a confidence interval provides a range, such as 2 to 4 hours, along with a specified confidence level, typically 95%. This indicates that if the same sampling procedure were repeated 100 times, approximately 95 of the resulting intervals would be expected to contain the true population mean.

A 95% confidence level does not imply a 95% probability that the true parameter lies within a particular calculated interval. The confidence level instead reflects the long-run reliability of the method used to generate the interval.{{Cite web |title=Confidence Intervals |url=http://www.stat.yale.edu/Courses/1997-98/101/confint.htm |website=Yale Department of Statistics |access-date=2025-04-05}}

History

Methods for calculating confidence intervals for the binomial proportion appeared from the 1920s.Edwin B. Wilson (1927) Probable Inference, the Law of Succession, and Statistical Inference, Journal of the American Statistical Association, 22:158, 209-212, https://doi.org/10.1080/01621459.1927.10502953C.J. Clopper, E.S. Pearson, The use of confidence or fiducial limits illustrated in the case of the binomial, Biometrika 26(4), 1934, pages 404–413, https://doi.org/10.1093/biomet/26.4.404 The main ideas of confidence intervals in general were developed in the early 1930s,Neyman, J. (1934). On the Two Different Aspects of the Representative Method: The Method of Stratified Sampling and the Method of Purposive Selection. Journal of the Royal Statistical Society, 97(4), 558–625. https://doi.org/10.2307/2342192 (see Note I in the appendix)J. Neyman (1935), Ann. Math. Statist. 6(3): 111-116 (September, 1935). https://doi.org/10.1214/aoms/1177732585Neyman, J. (1970). A glance at some of my personal experiences in the process of research. In Scientists at Work: Festschrift in honour of Herman Wold. Edited by T. Dalenius, G. Karlsson, S. Malmquist. Almqvist & Wiksell, Stockholm. https://worldcat.org/en/title/195948 and the first thorough and general account was given by Jerzy Neyman in 1937.

Neyman described the development of the ideas as follows (reference numbers have been changed):

[My work on confidence intervals] originated about 1930 from a simple question of Waclaw Pytkowski, then my student in Warsaw, engaged in an empirical study in farm economics. The question was: how to characterize non-dogmatically the precision of an estimated regression coefficient? ...

Pytkowski's monograph ... appeared in print in 1932.Pytkowski, W., The dependence of the income in small farms upon their area, the outlay and the capital invested in cows. (Polish, English summary) Bibliotaka Palawska, 1932. It so happened that, somewhat earlier, Fisher published his first paper{{cite journal

| last1=Fisher | first1=R. A. | authorlink1=Ronald Fisher

| date=1930

| title=Inverse Probability

| journal=Mathematical Proceedings of the Cambridge Philosophical Society

| volume=26

| issue=4

| pages=528–535

| doi=10.1017/S0305004100016297| bibcode=1930PCPS...26..528F }} concerned with fiducial distributions and fiducial argument. Quite unexpectedly, while the conceptual framework of fiducial argument is entirely different from that of confidence intervals, the specific solutions of several particular problems coincided. Thus, in the first paper in which I presented the theory of confidence intervals, published in 1934, I recognized Fisher's priority for the idea that interval estimation is possible without any reference to Bayes' theorem and with the solution being independent from probabilities a priori. At the same time I mildly suggested that Fisher's approach to the problem involved a minor misunderstanding.

In medical journals, confidence intervals were promoted in the 1970s but only became widely used in the 1980s.{{Cite journal|last=Altman|first=Douglas G.|date=1991|title=Statistics in medical journals: Developments in the 1980s|url=https://onlinelibrary.wiley.com/doi/abs/10.1002/sim.4780101206|journal=Statistics in Medicine|language=en|volume=10|issue=12|pages=1897–1913|doi=10.1002/sim.4780101206|pmid=1805317 |issn=1097-0258}} By 1988, medical journals were requiring the reporting of confidence intervals.{{Cite journal|last1=Gardner|first1=Martin J.|last2=Altman|first2=Douglas G.|date=1988|title=Estimating with confidence|url=https://doi.org/10.1136/bmj.296.6631.1210|journal=British Medical Journal|language=en|volume=296|issue=6631|pages=1210–1211|doi=10.1136/bmj.296.6631.1210 |pmid=3133015 |pmc=2545695 }}

Definition

Let X be a random sample from a probability distribution with statistical parameter (\theta, \varphi). Here, \theta is the quantity to be estimated, while \varphi includes other parameters (if any) that determine the distribution. A confidence interval for the parameter \theta, with confidence level or coefficient \gamma, is an interval (u(X), v(X)) determined by random variables u(X) and v(X) with the property:

: P(u(X) < \theta < v(X)) = \gamma \quad \text{for all }(\theta, \varphi).

The number \gamma, whose typical value is close to but not greater than 1, is sometimes given in the form 1 - \alpha (or as a percentage 100%\cdot(1 - \alpha)), where \alpha is a small positive number, often 0.05. It means that the interval (u(X), v(X)) has a probability \gamma of covering the value of \theta in repeated sampling.

In many applications, confidence intervals that have exactly the required confidence level are hard to construct, but approximate intervals can be computed. The rule for constructing the interval may be accepted if

: P(u(X) < \theta

to an acceptable level of approximation. Alternatively, some authors{{cite book |first=George G. |last=Roussas |year=1997 |title=A Course in Mathematical Statistics |edition=2nd |publisher=Academic Press |page=397}} simply require that

: P(u(X) < \theta < v(X)) \ge\ \gamma

When it is known that the coverage probability can be strictly larger than \gamma for some parameter values, the confidence interval is called conservative, i.e., it errs on the safe side; which also means that the interval can be wider than need be.

= Methods of derivation =

There are many ways of calculating confidence intervals, and the best method depends on the situation. Two widely applicable methods are bootstrapping and the central limit theorem.{{Cite journal |last1=Dekking |first1=Frederik Michel |last2=Kraaikamp |first2=Cornelis |last3=Lopuhaä |first3=Hendrik Paul |last4=Meester |first4=Ludolf Erwin |date=2005 |title=A Modern Introduction to Probability and Statistics |url=https://link.springer.com/book/10.1007/1-84628-168-7 |journal=Springer Texts in Statistics |language=en-gb |doi=10.1007/1-84628-168-7 |isbn=978-1-85233-896-1 |issn=1431-875X}} The latter method works only if the sample is large, since it entails calculating the sample mean \bar{X}_n and sample standard deviation S_n and assuming that the quantity

: \frac{\bar{X}_n - \mu}{S_n / \sqrt{n}}

is normally distributed, where \mu and n are the population mean and the sample size, respectively.

Example

File:Confidenceinterval.svg, the top ends of the brown bars indicate observed means and the red line segments ("error bars") represent the confidence intervals around them. Although the error bars are shown as symmetric around the means, that is not always the case. In most graphs, the error bars do not represent confidence intervals (e.g., they often represent standard errors or standard deviations).]]

Suppose X_1, \ldots, X_n is an independent sample from a normally distributed population with unknown parameters mean \mu and variance \sigma^2. Define the sample mean \bar{X} and unbiased sample variance S^2 as

: \bar{X} = \frac{{X_1 + \cdots + X_n}}{{n}},

: S^2 = \frac{{1}}{{n-1}}\sum_{i=1}^n (X_i - \bar{X})^2.

Then the value

: T = \frac{{\bar{X} - \mu}}{{S/\sqrt{n}}}

has a Student's t distribution with n - 1 degrees of freedom.Rees, D.G. (2001). Essential Statistics, 4th Edition, Chapman and Hall/CRC. {{isbn|1-58488-007-4}} (Section 9.5) This value is useful because its distribution does not depend on the values of the unobservable parameters \mu and \sigma^2; i.e., it is a pivotal quantity.

Suppose we wanted to calculate a 95% confidence interval for \mu. First, let c the 97.5th percentile of the distribution of T. Then there is a 2.5% chance that T will be less than -c and a 2.5% chance that it will be larger than +c (as the t distribution is symmetric about 0). In other words,

: P_T(-c \leq T \leq c) = 0.95.

Consequently, by replacing T with \frac{{\bar{X} - \mu}}{{S/\sqrt{n}}} and re-arranging terms,

: P_X {\left(\bar{X} - \frac{{cS}}{{\sqrt{n}}} \leq \mu \leq \bar{X} + \frac{{cS}}{{\sqrt{n}}}\right)} = 0.95

where P_X is the probability measure for the sample X_1, \ldots, X_n.

It means that there is 95% probability with which this condition \bar{X} - \frac{{cS}}{{\sqrt{n}}} \leq \mu \leq \bar{X} + \frac{{cS}}{{\sqrt{n}}} occurs in repeated sampling. After observing a sample, we find values \bar{x} for \bar{X} and s for S, from which we compute the below interval, and we say it is a 95% confidence interval for the mean.

: \left[\bar{x} - \frac{cs}{\sqrt{n}}, \bar{x} + \frac{cs}{\sqrt{n}}\right].

Interpretation

Various interpretations of a confidence interval can be given (taking the 95% confidence interval as an example in the following).

  • The confidence interval can be expressed in terms of a long-run frequency in repeated samples (or in resampling): "Were this procedure to be repeated on numerous samples, the proportion of calculated 95% confidence intervals that encompassed the true value of the population parameter would tend toward 95%."
  • The confidence interval can be expressed in terms of probability with respect to a single theoretical (yet to be realized) sample: "There is a 95% probability that the 95% confidence interval calculated from a given future sample will cover the true value of the population parameter." This essentially reframes the "repeated samples" interpretation as a probability rather than a frequency.
  • The confidence interval can be expressed in terms of statistical significance, e.g.: "The 95% confidence interval represents values that are not statistically significantly different from the point estimate at the .05 level."Cox D.R., Hinkley D.V. (1974) Theoretical Statistics, Chapman & Hall, pp. 214, 225, 233

File:95% confidence interval.svg

= Common misunderstandings =

File:Neyman_Construction_Confidence_Intervals.png

Confidence intervals and levels are frequently misunderstood, and published studies have shown that even professional scientists often misinterpret them.Hoekstra, R., R. D. Morey, J. N. Rouder, and E-J. Wagenmakers, 2014. Robust misinterpretation of confidence intervals. Psychonomic Bulletin & Review Vol. 21, No. 5, pp. 1157-1164. [http://www.ejwagenmakers.com/inpress/HoekstraEtAlPBR.pdf]

  • A 95% confidence level does not mean that for a given realized interval there is a 95% probability that the population parameter lies within the interval.
  • A 95% confidence level does not mean that 95% of the sample data lie within the confidence interval.
  • A 95% confidence level does not mean that there is a 95% probability of the parameter estimate from a repeat of the experiment falling within the confidence interval computed from a given experiment.{{Cite journal |last1=Greenland |first1=Sander |last2=Senn |first2=Stephen J. |last3=Rothman |first3=Kenneth J. |last4=Carlin |first4=John B. |last5=Poole |first5=Charles |last6=Goodman |first6=Steven N. |last7=Altman |first7=Douglas G. |date=April 2016 |title=Statistical tests, P values, confidence intervals, and power: a guide to misinterpretations |journal=European Journal of Epidemiology |volume=31 |issue=4 |pages=337–350 |doi=10.1007/s10654-016-0149-3 |issn=0393-2990 |pmc=4877414 |pmid=27209009}}

For example, suppose a factory produces metal rods. A random sample of 25 rods gives a 95% confidence interval for the population mean length of 36.8 to 39.0 mm.{{Cite journal |last1=Tan |first1=Sze Huey |last2=Tan |first2=Say Beng |date=2010-09-01 |title=The Correct Interpretation of Confidence Intervals |journal=Proceedings of Singapore Healthcare |language=EN |volume=19 |issue=3 |pages=276–278 |doi=10.1177/201010581001900316 |issn=2010-1058|doi-access=free }}

  • It is incorrect to say that there is a 95% probability that the true population mean lies within this interval, because the true mean is fixed, not random. For example, it might be 37 mm, which is within the confidence interval, or 40 mm, which is not; in any case, whether it falls between 36.8 and 39.0 mm is a matter of fact, not probability.
  • It is not necessarily true that the lengths of 95% of the sampled rods lie within this interval. In this case, it cannot be true: 95% of 25 is not an integer.
  • It is incorrect to say that if we took a second sample, there is a 95% probability that the sample mean length (an estimate of the population mean length) would fall within this interval. In fact, if the true mean length is far from this specific confidence interval, it could be very unlikely that the next sample mean falls within the interval.

Instead, the 95% confidence level means that if we took 100 such samples, we would expect the true population mean to lie within approximately 95 of the calculated intervals.

= Comparison with [[prediction interval]]s =

A confidence interval is used to estimate a population parameter, such as the mean. For example, the expected value of a fair six-sided die is 3.5. Based on repeated sampling, after computing many 95% confidence intervals, roughly 95% of them will contain 3.5.

A prediction interval, on the other hand, provides a range within which a future individual observation is expected to fall with a certain probability. In the case of a single roll of a fair six-sided die, the outcome will always lie between 1 and 6. Thus, a 95% prediction interval for a future roll is approximately [1, 6], since this range captures the inherent variability of individual outcomes.

The key distinction is that confidence intervals quantify uncertainty in estimating parameters, while prediction intervals quantify uncertainty in forecasting future observations.

= Comparison with [[credible interval]]s =

In many common settings, such as estimating the mean of a normal distribution with known variance,{{Cite book |last=Bolstad |first=William M. |url=https://www.worldcat.org/title/122338165 |title=Introduction to Bayesian statistics |date=2007 |publisher=John Wiley |isbn=978-0-470-14115-1 |edition=2nd |location=Hoboken, N.J |pages=223–236 |oclc=122338165}} confidence intervals coincide with credible intervals under non-informative priors. In such cases, common misconceptions about confidence intervals (e.g. interpreting them as probability statements about the parameter) may yield practically correct conclusions.

= Examples of how naïve interpretation of confidence intervals can be problematic =

== Confidence procedure for uniform location ==

File:Welch and Bayes intervals.svg

Welch{{cite journal |last= Welch|first=B. L. |date= 1939|title= On Confidence Limits and Sufficiency, with Particular Reference to Parameters of Location|jstor= 2235987 |journal= The Annals of Mathematical Statistics|volume= 10|issue= 1|pages= 58–69| doi= 10.1214/aoms/1177732246|doi-access= free}} presented an example which clearly shows the difference between the theory of confidence intervals and other theories of interval estimation (including Fisher's fiducial intervals and objective Bayesian intervals). Robinson{{cite journal |last= Robinson|first=G. K. |date= 1975|title= Some Counterexamples to the Theory of Confidence Intervals|jstor= 2334498 |journal= Biometrika|volume= 62| issue= 1|pages= 155–161|doi=10.2307/2334498}} called this example "[p]ossibly the best known counterexample for Neyman's version of confidence interval theory." To Welch, it showed the superiority of confidence interval theory; to critics of the theory, it shows a deficiency. Here we present a simplified version.

Suppose that X_1,X_2 are independent observations from a uniform (\theta - 1/2, \theta + 1/2) distribution. Then the optimal 50% confidence procedure for \theta is{{cite journal |last= Pratt|first=J. W. |date= 1961| title= Book Review: Testing Statistical Hypotheses. by E. L. Lehmann|jstor= 2282344 |journal= Journal of the American Statistical Association|volume= 56|issue= 293|pages= 163–167|doi= 10.1080/01621459.1961.10482103}}

: \bar{X} \pm \begin{cases}

\dfrac

X_1-X_2
{2} & \text{if } |X_1-X_2| < 1/2 \\[8pt]

\dfrac{1-|X_1-X_2|}{2} &\text{if } |X_1-X_2| \geq 1/2.

\end{cases}

A fiducial or objective Bayesian argument can be used to derive the interval estimate

: \bar{X} \pm \frac{1-|X_1-X_2|}{4},

which is also a 50% confidence procedure. Welch showed that the first confidence procedure dominates the second, according to desiderata from confidence interval theory; for every \theta_1\neq\theta, the probability that the first procedure contains \theta_1 is less than or equal to the probability that the second procedure contains \theta_1. The average width of the intervals from the first procedure is less than that of the second. Hence, the first procedure is preferred under classical confidence interval theory.

However, when |X_1-X_2| \geq 1/2, intervals from the first procedure are guaranteed to contain the true value \theta: Therefore, the nominal 50% confidence coefficient is unrelated to the uncertainty we should have that a specific interval contains the true value. The second procedure does not have this property.

Moreover, when the first procedure generates a very short interval, this indicates that X_1,X_2 are very close together and hence only offer the information in a single data point. Yet the first interval will exclude almost all reasonable values of the parameter due to its short width. The second procedure does not have this property.

The two counter-intuitive properties of the first procedure – 100% coverage when X_1,X_2 are far apart and almost 0% coverage when X_1,X_2 are close together – balance out to yield 50% coverage on average. However, despite the first procedure being optimal, its intervals offer neither an assessment of the precision of the estimate nor an assessment of the uncertainty one should have that the interval contains the true value.

This example is used to argue against naïve interpretations of confidence intervals. If a confidence procedure is asserted to have properties beyond that of the nominal coverage (such as relation to precision, or a relationship with Bayesian inference), those properties must be proved; they do not follow from the fact that a procedure is a confidence procedure.

== Confidence procedure for ''ω''<sup>2</sup> ==

Steiger{{cite journal |last= Steiger|first=J. H. |date= 2004|title= Beyond the F test: Effect size confidence intervals and tests of close fit in the analysis of variance and contrast analysis|journal= Psychological Methods|volume= 9|issue= 2|pages= 164–182|doi= 10.1037/1082-989x.9.2.164|pmid=15137887 }} suggested a number of confidence procedures for common effect size measures in ANOVA. Morey et al. point out that several of these confidence procedures, including the one for ω2, have the property that as the F statistic becomes increasingly small—indicating misfit with all possible values of ω2—the confidence interval shrinks and can even contain only the single value ω2 = 0; that is, the CI is infinitesimally narrow (this occurs when p\geq1-\alpha/2 for a 100(1-\alpha)\% CI).

This behavior is consistent with the relationship between the confidence procedure and significance testing: as F becomes so small that the group means are much closer together than we would expect by chance, a significance test might indicate rejection for most or all values of ω2. Hence the interval will be very narrow or even empty (or, by a convention suggested by Steiger, containing only 0). However, this does not indicate that the estimate of ω2 is very precise. In a sense, it indicates the opposite: that the trustworthiness of the results themselves may be in doubt. This is contrary to the common interpretation of confidence intervals that they reveal the precision of the estimate.

Confidence interval for specific distributions

See also

  • {{Annotated link|CLs upper limits (particle physics)}}
  • 68–95–99.7 rule
  • Confidence band, an interval estimate for a curve
  • {{Annotated link|Confidence distribution}}
  • {{Annotated link|Confidence region}}, a higher dimensional generalization
  • {{Annotated link|Credence (statistics)}}
  • Credible interval, a Bayesian alternative for interval estimation
  • {{Annotated link|CDF-based nonparametric confidence interval|Cumulative distribution function-based nonparametric confidence interval}}
  • {{Annotated link|Error bar}}
  • {{Annotated link|Estimation statistics}}
  • Margin of error, the CI halfwidth
  • {{Annotated link|p-value}}
  • Prediction interval, an interval estimate for a random variable
  • Probable error
  • {{Annotated link|Robust confidence intervals}}

References

{{Reflist|30em|refs=

Cox D.R., Hinkley D.V. (1974) Theoretical Statistics, Chapman & Hall, p49, p209

{{cite journal |last1= Morey|first1=R. D. |last2=Hoekstra|first2= R.|last3=Rouder|first3=J. N. | last4=Lee|first4=M. D.|last5=Wagenmakers|first5=E.-J.|date= 2016|title= The Fallacy of Placing Confidence in Confidence Intervals |journal= Psychonomic Bulletin & Review|volume= 23|issue= 1|pages= 103–123|doi= 10.3758/s13423-015-0947-8|pmid=26450628 |pmc=4742505 }}

{{cite journal | last1 = Neyman | first1 = J. | author-link = Jerzy Neyman | year = 1937 | title = Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability | jstor = 91337 | journal = Philosophical Transactions of the Royal Society A | volume = 236 | issue = 767| pages = 333–380 | doi=10.1098/rsta.1937.0005| bibcode = 1937RSPTA.236..333N | doi-access = free }}

}}

Bibliography

{{refbegin}}

{{divcol}}

  • {{springer|title=Confidence estimation|id=p/c024620}}
  • Fisher, R.A. (1956) Statistical Methods and Scientific Inference. Oliver and Boyd, Edinburgh. (See p. 32.)
  • Freund, J.E. (1962) Mathematical Statistics Prentice Hall, Englewood Cliffs, NJ. (See pp. 227–228.)
  • Hacking, I. (1965) Logic of Statistical Inference. Cambridge University Press, Cambridge. {{isbn|0-521-05165-7}}
  • Keeping, E.S. (1962) Introduction to Statistical Inference. D. Van Nostrand, Princeton, NJ.
  • {{cite journal | last1 = Kiefer | first1 = J. | author-link = Jack Kiefer (mathematician) | year = 1977 | title = Conditional Confidence Statements and Confidence Estimators (with discussion) | jstor = 2286460 | journal = Journal of the American Statistical Association | volume = 72 | issue = 360a| pages = 789–827 | doi=10.1080/01621459.1977.10479956}}
  • Mayo, D. G. (1981) [http://www.phil.vt.edu/dmayo/PhilStatistics/In%20Defense%20of%20the%20Neyman-Pearson%20Theory%20of%20Confidence%20Intervals.pdf "In defence of the Neyman–Pearson theory of confidence intervals"], Philosophy of Science, 48 (2), 269–280. {{JSTOR|187185}}.
  • Mehta, S. (2014) Statistics Topics. {{isbn|978-1-4992-7353-3}}.
  • {{cite journal|last1=Morey|first1=R. D.|last2=Hoekstra|first2=R.|last3=Rouder|first3=J. N.|last4=Lee|first4=M. D.|last5=Wagenmakers|first5=E.-J.|title=The fallacy of placing confidence in confidence intervals|journal=Psychonomic Bulletin & Review|volume=23|issue=1|year=2016|pages=103–123|doi=10.3758/s13423-015-0947-8|pmid=26450628|pmc=4742505}}
  • Neyman, J. (1937) [https://www.jstor.org/stable/91337 "Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability"] Philosophical Transactions of the Royal Society of London A, 236, 333–380. (Seminal work)
  • {{cite journal | last1 = Robinson | first1 = G.K. | year = 1975 | title = Some Counterexamples to the Theory of Confidence Intervals | jstor = 2334498 | journal = Biometrika | volume = 62 | issue = 1| pages = 155–161 | doi=10.1093/biomet/62.1.155}}
  • Savage, L. J. (1962), The Foundations of Statistical Inference. Methuen, London.
  • Smithson, M. (2003) Confidence intervals. Quantitative Applications in the Social Sciences Series, No. 140. Belmont, CA: SAGE Publications. {{isbn|978-0-7619-2499-9}}.

{{divcolend}}

{{refend}}