1. Home
  2. Explore
  3. Statistics
  4. Confidence Intervals and Hypothesis Testing

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Confidence Intervals and Hypothesis Testing

Confidence Intervals, Hypothesis Testing, and ppp-Values

1. Statistical Inference: From Samples to Populations

Researchers are usually interested in learning about a population, but it is rarely practical or possible to measure every member of that population. Instead, researchers select a sample from the population and use the sample results to make conclusions about the population.

Statistical inference is the process of using information from a sample to draw conclusions about the population from which the sample was taken.

For example, a study may aim to determine the average weight loss caused by a program among all women in the United Kingdom aged 20–35. Measuring every woman in this population would be impractical, so researchers recruit a sample of women in that age range and measure their weight loss.

The sample might be used to calculate:

  • A mean

  • A median

  • A proportion or percentage

  • A difference between groups

  • An association or effect

The sample result is an estimate of the corresponding population value. Because the sample does not include everyone, the estimate will not usually equal the exact population value.

Statistical tools such as the standard error, confidence interval, and ppp-value help assess:

  • How precise the sample estimate is

  • How much the estimate might vary between samples

  • Whether the observed result could plausibly have occurred by chance

  • How strongly the data support the existence of a real effect


2. Weight-Loss Program Example

A hypothetical weight-loss study recruits 100 women aged 20–35. Each participant is weighed before and after taking part in the intervention.

The sample results are:

  • Average weight before the intervention: 707070 kilograms

  • Average weight after the intervention: 66.366.366.3 kilograms

  • Average weight loss: 3.73.73.7 kilograms

The sample therefore suggests that participants lost an average of 3.73.73.7 kilograms.

However, the difference in sample means alone is not enough to determine whether the intervention has a genuine effect. The observed difference could partly reflect sampling variation, meaning that a different sample might have produced a somewhat different result.

To assess the evidence more fully, researchers use:

  • A confidence interval, which describes the uncertainty around the estimated effect

  • A ppp-value, which assesses how compatible the result is with a null hypothesis of no effect

For this example, the 95%95\%95% confidence interval for the mean weight loss is approximately 3.43.43.4 to 4.04.04.0 kilograms. This indicates that the estimated population weight loss is likely to be within this range under the interpretation used in the study.

Because the entire interval represents weight loss of at least 3.43.43.4 kilograms, even the lower end suggests a potentially meaningful effect. The associated ppp-value is very small, providing strong evidence against the idea that the observed difference is merely due to chance.


3. Examples of Statistical Inference

Statistical inference is used in several common types of research questions.

Estimating a Population Characteristic

A researcher might estimate the percentage of smokers in the United Kingdom.

  • The sample produces an estimated percentage.

  • A confidence interval is calculated around that percentage.

  • The interval indicates the uncertainty in using the sample percentage to represent the entire population.

Comparing Measurements Before and After an Intervention

In the weight-loss study, each participant is measured before and after the intervention.

  • The difference between the two measurements is calculated.

  • The mean difference represents the average change.

  • A confidence interval is calculated around that mean change.

Comparing Two Treatment Groups

Researchers may compare:

  • E-cigarettes with nicotine versus placebo e-cigarettes

  • Statins versus a placebo

  • Two different weight-loss interventions

The result may be expressed as a mean difference, a proportion difference, a risk ratio, or another comparison measure. A confidence interval indicates the uncertainty surrounding that comparison.

Comparing One Active Treatment with Another

A study might compare:

  • Nicotine e-cigarettes with nicotine patches

  • Paracetamol with ibuprofen

For outcomes such as pain scores, the difference between the treatments can be estimated even when the scores themselves have no physical units. A confidence interval can still be calculated around the difference.


4. Sampling Variation and Sampling Error

Whenever researchers take a sample, they obtain only one of many possible samples from the population. If the study were repeated using a different sample, the result would probably be somewhat different.

Sampling variation, also called sampling error, is the natural variation in an estimate that occurs because different samples contain different individuals.

For example, if the weight-loss study were repeated several times:

  • One sample might show an average loss of 3.53.53.5 kilograms.

  • Another might show 3.83.83.8 kilograms.

  • Another might show 3.23.23.2 kilograms.

  • The estimates would usually be similar but would not be identical.

Sampling variation does not necessarily indicate a mistake. It is an unavoidable consequence of studying a sample rather than the entire population.

The key question is therefore not whether sampling variation exists, but whether the observed result is:

  • Small enough to be plausibly explained by sampling variation alone, or

  • So large that sampling variation alone seems unlikely to explain it

Confidence intervals and ppp-values help answer this question.


5. Precision and Accuracy

A good sample estimate should ideally be both precise and accurate, but these terms describe different properties.

Precision

Precision describes how close repeated estimates are to one another.

  • High precision means that repeated samples produce similar results.

  • Low precision means that repeated samples produce widely different results.

Precision concerns the amount of random variation in the estimates. It does not necessarily indicate whether the estimates are close to the truth.

Accuracy

Accuracy describes how close an estimate is to the true population value.

  • High accuracy means that the estimate is close to the truth.

  • Low accuracy means that the estimate is far from the truth.

Accuracy may be affected by systematic problems such as biased sampling, poor measurement methods, or confounding.

The Four Possible Combinations

An estimate can be:

Precise and Accurate

Repeated estimates are close to one another and close to the true population value. This is the ideal situation.

Precise but Inaccurate

Repeated estimates are tightly clustered but consistently far from the truth. This can occur when there is systematic bias.

Imprecise but Accurate on Average

Individual estimates vary widely, but their average is close to the true value.

Imprecise and Inaccurate

Estimates are widely scattered and are not centered around the true value.

A useful analogy is a target:

  • The center of the target represents the truth.

  • Arrows close together represent precision.

  • Arrows close to the center represent accuracy.

Precision concerns consistency; accuracy concerns closeness to the truth.

In practice, researchers can estimate precision using the standard error. Accuracy is more difficult to assess because the true population value is usually unknown.


6. Standard Error

The standard error measures the expected variation of a sample estimate across repeated samples. It is therefore a measure of the estimate’s precision.

A smaller standard error indicates greater precision. A larger standard error indicates less precision.

For a sample mean, the standard error is calculated as:

SE=SDnSE = \frac{SD}{\sqrt{n}}SE=n​SD​

where:

  • SESESE is the standard error

  • SDSDSD is the sample standard deviation

  • nnn is the sample size

Factors Affecting Standard Error

Standard Deviation

A larger standard deviation means that individual observations are more variable. This increases the standard error and reduces precision.

A smaller standard deviation means that observations are more similar. This reduces the standard error and increases precision.

Sample Size

A larger sample size reduces the standard error and increases precision.

Because sample size appears under a square root, increasing the sample size improves precision, but not in a simple one-to-one way. For example, substantially increasing the sample size is needed to produce a large reduction in standard error.

The relationship is:

SE∝1nSE \propto \frac{1}{\sqrt{n}}SE∝n​1​

Thus:

  • Larger nnn produces a smaller SESESE.

  • Smaller nnn produces a larger SESESE.

Researchers can usually influence sample size during study planning, but they generally cannot directly control the natural variability of the outcome being measured.

Weight-Loss Example

Suppose:

  • Standard deviation: 1.51.51.5 kilograms

  • Sample size: 100100100

The standard error is:

SE=1.5100SE = \frac{1.5}{\sqrt{100}}SE=100​1.5​

Since 100=10\sqrt{100}=10100​=10:

SE=1.510=0.15SE = \frac{1.5}{10}=0.15SE=101.5​=0.15

The standard error of the estimated mean weight loss is therefore 0.150.150.15 kilograms.

The standard error may not always be prominently reported in research papers, but it is essential for calculating confidence intervals and many statistical tests.


7. Sampling Distributions

A sampling distribution describes the values of a statistic, such as a sample mean, across many repeated samples from the same population.

Imagine repeating the weight-loss study 1,000 times, each time recruiting a new sample of 20 women and calculating the mean weight loss. The result from each study would be one observation in the sampling distribution.

This distribution would show:

  • The mean of the repeated sample means

  • The amount of variation among the sample means

  • The standard error of the sample mean

  • The likelihood of obtaining different estimates

Although individual studies may produce quite different results, most sample means would cluster around the true population mean.

Some repeated studies might find:

  • A weight loss close to the average

  • A larger-than-average weight loss

  • Little or no weight loss

  • A negative weight loss, which would indicate an average weight gain

If the sampling distribution is approximately normal, the usual properties of the normal distribution apply. Approximately 95%95\%95% of sample means fall within about two standard errors of the true mean:

True mean−2SEtoTrue mean+2SE\text{True mean} - 2SE \quad \text{to} \quad \text{True mean} + 2SETrue mean−2SEtoTrue mean+2SE

More precisely, 95%95\%95% of values in a normal distribution lie within approximately 1.961.961.96 standard deviations of the mean. For a sampling distribution, the equivalent quantity is approximately 1.961.961.96 standard errors.


8. Confidence Intervals

A confidence interval is a range of plausible values for a population parameter based on a sample estimate.

For a 95%95\%95% confidence interval around a sample mean, the general formula is:

Sample mean±1.96×SE\text{Sample mean} \pm 1.96 \times SESample mean±1.96×SE

The lower and upper limits are calculated separately:

Lower limit=Sample mean−1.96×SE\text{Lower limit} = \text{Sample mean} - 1.96 \times SELower limit=Sample mean−1.96×SE
Upper limit=Sample mean+1.96×SE\text{Upper limit} = \text{Sample mean} + 1.96 \times SEUpper limit=Sample mean+1.96×SE

The sample estimate lies exactly halfway between the lower and upper limits when the interval is constructed symmetrically in this way.

Interpreting a 95%95\%95% Confidence Interval

A confidence interval expresses uncertainty caused by sampling variation.

In the weight-loss example, the 95%95\%95% confidence interval is 3.43.43.4 to 4.04.04.0 kilograms. It is commonly reported as:

The estimated average weight loss is 3.73.73.7 kilograms, with a 95%95\%95% confidence interval from 3.43.43.4 to 4.04.04.0 kilograms.

The interval suggests that the true population mean weight loss is plausibly somewhere between 3.43.43.4 and 4.04.04.0 kilograms.

A more precise frequentist interpretation is that if the same study procedure were repeated many times, approximately 95%95\%95% of the confidence intervals constructed in this way would contain the true population value. The 5%5\%5% remaining intervals would not contain the true value.

The confidence level is chosen by the researcher. A 95%95\%95% confidence level means that the method is designed to capture the true value in approximately 95%95\%95% of repeated applications.

Narrow and Wide Confidence Intervals

Narrow Confidence Interval

A narrow interval indicates a precise estimate.

It usually results from:

  • A large sample size

  • A small standard deviation

  • A small standard error

Wide Confidence Interval

A wide interval indicates an imprecise estimate.

It may result from:

  • A small sample size

  • A large standard deviation

  • A large standard error

A confidence interval communicates both the estimated effect and the uncertainty surrounding that effect.

Calculating the Weight-Loss Confidence Interval

The estimate is:

xˉ=3.7\bar{x}=3.7xˉ=3.7

The standard error is:

SE=0.15SE=0.15SE=0.15

The lower limit is:

3.7−1.96(0.15)≈3.43.7 - 1.96(0.15) \approx 3.43.7−1.96(0.15)≈3.4

The upper limit is:

3.7+1.96(0.15)≈4.03.7 + 1.96(0.15) \approx 4.03.7+1.96(0.15)≈4.0

Therefore, the approximate 95%95\%95% confidence interval is:

3.4 kilograms to 4.0 kilograms3.4 \text{ kilograms to } 4.0 \text{ kilograms}3.4 kilograms to 4.0 kilograms

9. Confidence Intervals Across Repeated Studies

Suppose the same study is conducted 100 times using a different sample each time. Each study produces:

  • An estimated treatment effect

  • A confidence interval around that estimate

The true population effect remains fixed, but the sample estimates vary from study to study.

Approximately 95%95\%95% of the confidence intervals will contain the true effect. Approximately 5%5\%5% will fail to contain it.

Thus, a confidence interval from a single study is not guaranteed to contain the true value. The researcher cannot know whether the particular interval obtained is one of the approximately 95%95\%95% that contains the truth or one of the approximately 5%5\%5% that does not.

This is why confidence intervals express uncertainty rather than certainty.


10. Systematic Reviews and Meta-Analyses

Although an individual study can only provide one estimate, researchers can combine results from multiple studies in a systematic review or meta-analysis.

A forest plot commonly displays:

  • The effect estimate from each study

  • The confidence interval for each estimate

  • A vertical line representing no effect

  • A combined estimate based on all included studies

Individual studies may produce estimates that vary widely. Some confidence intervals may be narrow, while others may be wide. Combining the studies can produce an overall estimate that is more precise and potentially closer to the true population effect than many of the individual estimates.

The line of no effect depends on the type of outcome measure:

  • For a mean difference, no effect is usually represented by 000.

  • For a ratio such as a risk ratio or odds ratio, no effect is usually represented by 111.


11. Hypothesis Testing

Hypothesis testing is a formal method for evaluating whether observed data provide evidence against a specified null hypothesis.

The process begins by defining a null hypothesis.

The null hypothesis states that there is no effect, no difference, or no association in the population.

For the weight-loss study, the null hypothesis could be:

  • The average weight before and after the intervention is the same.

  • The intervention has no effect on weight.

  • The true mean weight loss is 000 kilograms.

After defining the null hypothesis, a statistical test is performed. The test evaluates how compatible the observed data are with the assumption that the null hypothesis is true.

The central question is:

If there were truly no effect, how likely would it be to observe a result at least as extreme as the one found in the study?

The answer is summarized by the ppp-value.


12. ppp-Values

A ppp-value is the probability of observing a result at least as extreme as the result obtained, assuming that the null hypothesis is true.

A ppp-value measures how compatible the observed data are with the null hypothesis.

It does not directly represent:

  • The probability that the null hypothesis is true

  • The probability that the research hypothesis is true

  • The size or practical importance of the effect

  • The probability that the result will replicate exactly

Interpreting a ppp-Value of 0.0010.0010.001

A ppp-value of 0.0010.0010.001 means that, if the null hypothesis were true, the probability of observing a result at least this extreme would be 0.0010.0010.001, or approximately 111 in 1,0001{,}0001,000.

This would be considered strong evidence against the null hypothesis because such a result would be very unusual if there were truly no effect.

Interpreting a ppp-Value of 0.10.10.1

A ppp-value of 0.10.10.1 means that, if the null hypothesis were true, the probability of observing a result at least this extreme would be 0.10.10.1, or 111 in 101010.

This result is more compatible with sampling variation under the null hypothesis than a result with a ppp-value of 0.0010.0010.001.

Strength of Evidence

The smaller the ppp-value, the stronger the evidence against the null hypothesis.

This can be viewed as a gradient:

  • Very small ppp-value: Strong evidence against no effect

  • Moderate ppp-value: Weaker evidence against no effect

  • Large ppp-value: Little evidence against no effect

A small ppp-value suggests that the observed result would be unusual if the null hypothesis were true. It does not prove that the alternative explanation is true, and a large ppp-value does not prove that there is no effect.


13. The Sampling Distribution Under the Null Hypothesis

To understand a ppp-value, imagine repeating the same study many times while assuming that the null hypothesis is true.

For the weight-loss example, assume:

  • The intervention has no effect.

  • The true mean weight loss is 000 kilograms.

  • Any observed differences result only from sampling variation.

If the study were repeated 1,000 times:

  • Most sample estimates would be close to 000.

  • Some samples might show a small apparent weight loss.

  • Some might show a small apparent weight gain.

  • A few might show more extreme results.

The statistical test determines how far the observed sample estimate is from the null value in standard-error units.

The distance can be expressed conceptually as:

Observed estimate−Null valueSE\frac{\text{Observed estimate} - \text{Null value}}{SE}SEObserved estimate−Null value​

For the weight-loss example:

  • Observed estimate: 3.73.73.7 kilograms

  • Null value: 000 kilograms

  • Standard error: 0.150.150.15 kilograms

The estimate is therefore:

3.7−00.15≈24.7\frac{3.7-0}{0.15} \approx 24.70.153.7−0​≈24.7

standard errors above the null value. This is an extremely large distance from the value expected under the null hypothesis, making such a result very unlikely to arise from sampling variation alone.

Consequently, the ppp-value is extremely small, reported in the source as less than 0.0010.0010.001.

A statistical test assesses how far the observed estimate lies from the null value relative to the standard error.


14. Confidence Intervals and ppp-Values Together

Confidence intervals and ppp-values address related aspects of statistical inference.

Confidence Intervals

Confidence intervals show:

  • The estimated size of the effect

  • The range of plausible population values

  • The precision of the estimate

  • Whether the effect could plausibly be close to no effect

ppp-Values

ppp-values show:

  • How unusual the observed result would be if there were no effect

  • The strength of evidence against the null hypothesis

  • Whether sampling variation alone provides a plausible explanation

A confidence interval is often more informative than a ppp-value alone because it shows both the magnitude and uncertainty of an effect.

For example, the weight-loss result can be summarized as:

The estimated mean weight loss was 3.73.73.7 kilograms, with a 95%95\%95% confidence interval from 3.43.43.4 to 4.04.04.0 kilograms. The probability of observing a difference this extreme due to sampling variation, assuming no true effect, was less than 111 in 1,0001{,}0001,000.

This statement communicates:

  • The estimated effect: 3.73.73.7 kilograms

  • The uncertainty: 3.43.43.4 to 4.04.04.0 kilograms

  • The evidence against no effect: p<0.001p<0.001p<0.001


15. Electronic Cigarettes and Smoking Cessation

A randomized controlled trial investigated methods for helping people stop smoking. Participants were assigned to three groups:

  • E-cigarettes containing nicotine

  • E-cigarettes without nicotine, serving as a placebo group

  • Nicotine patches

The researchers examined the time until participants relapsed after stopping smoking.

The results were reported using:

  • An estimated time to relapse

  • A confidence interval around each estimate

  • A ppp-value for comparisons between groups

The nicotine e-cigarette group had an estimated median time to relapse of approximately 353535 days. The confidence interval suggested that the true median time to relapse could plausibly be between approximately 151515 and 565656 days.

For the nicotine-patch group, the estimated true time to relapse was reported as approximately:

  • 888 to 181818 days within its confidence interval

For the placebo e-cigarette group, the corresponding interval was approximately:

  • 555 to 343434 days

The researchers compared:

  1. Nicotine e-cigarettes with nicotine patches

  2. Nicotine e-cigarettes with placebo e-cigarettes

For each comparison, the paper reported an estimate, a confidence interval, and a ppp-value. The ppp-value for a comparison describes the evidence regarding the difference between those two groups, rather than simply describing the result within one group.

This illustrates how research papers commonly present statistical results: the estimate describes the observed effect, the confidence interval describes its uncertainty, and the ppp-value indicates how compatible the comparison is with a null hypothesis of no difference.


Key Takeaways

  • Statistical inference uses sample data to draw conclusions about a wider population.

  • Sampling variation occurs because different samples produce different estimates.

  • Precision concerns how closely repeated estimates agree with one another.

  • Accuracy concerns how close an estimate is to the true population value.

  • Standard error measures the precision of a sample estimate.

  • For a sample mean, the standard error is SE=SDnSE=\frac{SD}{\sqrt{n}}SE=n​SD​.

  • Larger samples generally produce smaller standard errors and narrower confidence intervals.

  • A confidence interval gives a range of plausible values for the population parameter.

  • A 95%95\%95% confidence interval is commonly calculated as estimate±1.96×SE\text{estimate}\pm1.96\times SEestimate±1.96×SE.

  • A confidence interval can be narrow and precise or wide and imprecise.

  • The null hypothesis states that there is no effect or difference.

  • A ppp-value is the probability of observing a result at least as extreme as the study result, assuming the null hypothesis is true.

  • Smaller ppp-values provide stronger evidence against the null hypothesis.

  • Confidence intervals describe effect size and uncertainty, while ppp-values describe compatibility with the null hypothesis.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent