StepWise USMLE
Biostatistics: inference

Confidence Intervals, Hypothesis Testing and Statistical Tests

A plain-language guide to judging whether a study result is real, and to picking the right test.

🔑 Key Words First

glossary

Plain-language glossary

WordPlain meaning
PopulationThe whole group you want to learn about
SampleThe smaller group you actually measure
InferenceUsing a sample to draw conclusions about the population
Sampling errorNatural difference between a sample result and the true population value
MeanThe average
Standard deviation (SD)The typical distance of values from the mean
Standard error (SE)How much a sample's result would wobble if you repeated the study
Confidence interval (CI)A range likely to contain the true population value
Confidence levelHow often such ranges capture the truth (usually 95%)
Z scoreNumber of SDs from the mean; used as the multiplier in intervals
Null hypothesisThe 'nothing is going on' claim: any finding is chance
Alternative hypothesisThe claim that something real is going on
One-tailed testTests for a difference in one direction only
Two-tailed testTests for a difference in either direction
Test statisticA number computed from the data that measures how far results are from the null hypothesis
p-valueChance of results at least this extreme if the null hypothesis were true
Alpha (α) / significance levelThe p-value cutoff you set in advance, usually 0.05
Statistically significantA result with p-value at or below alpha
Type I errorConcluding there is an effect when there is none (false alarm)
Type II errorMissing a real effect (missed finding)
Beta (β)Chance of a type II error
PowerChance of detecting a real effect (1 − β)
Effect sizeHow big the difference or relationship actually is
Nominal / ordinal / interval dataCategories / ranked categories / numbers with equal gaps
Correlation coefficient (r)A number from −1 to +1 showing the strength and direction of a straight-line link
ScatterplotA graph with one dot per person, plotting two measurements
t-testCompares the means of two groups
Paired (matched) t-testCompares two linked measurements, such as before and after in the same people
ANOVA (analysis of variance)Compares the means of three or more groups
F statisticThe test number produced by ANOVA
Chi-square testCompares counts across categories
RegressionPredicts one measurement from another using a fitted line
Relative risk (RR)Risk in exposed divided by risk in unexposed
Odds ratio (OR)Ratio of exposure odds in cases to controls

🧭 Big Picture

overview
  • Descriptive statistics summarize the people you measured
  • Inferential statistics ask what the sample says about everyone else
  • Core problem:
    • Samples differ from the population by chance
    • Is the finding real, or just luck of the draw?
  • Tools in this note:
    • Confidence intervals show a plausible range
    • Hypothesis tests judge if chance alone could explain the result
    • Statistical tests are chosen by the type of data

Everyday analogy: tasting soup

  • One spoonful is the sample; the whole pot is the population.
  • Spoonfuls vary a little, so one taste is only an estimate.
  • A confidence interval is the range of flavors the pot probably has.
  • A hypothesis test asks: is this soup truly saltier than the usual recipe, or just a salty spoonful?

📏 Standard Error and Confidence Intervals

estimation
  • Where this fits: a sample result is an estimate, so we attach a margin of uncertainty

SD versus standard error

MeasureDescribesFormulaShrinks with bigger sample?
SDSpread of individual values in one sampleFrom the dataNo
Standard errorSpread of the sample mean across repeated samplesSE = SD ÷ √nYes
  • Larger SD gives larger SE
  • Larger sample gives smaller SE
  • To halve the SE, the sample must be four times larger

Building a confidence interval

Take the study result→Multiply SE by Z→Add and subtract
  • CI = result ± Z × SE
  • Z for 95% confidence ≈ 1.96 (often rounded to 2)
  • Z for 99% confidence ≈ 2.58

Worked example

  • Sample of 64 patients; mean cholesterol 200 mg/dL; SD 32
  • SE = 32 ÷ √64 = 32 ÷ 8 = 4
  • 95% CI = 200 ± 1.96 × 4 ≈ 200 ± 7.8
    • About 192 to 208
  • 99% CI = 200 ± 2.58 × 4 ≈ 200 ± 10.3
    • About 190 to 210
  • With 256 patients and the same SD: SE = 2, so the 95% CI narrows to about 196 to 204
If this changesInterval widthPrecisionConfidence
Higher confidence level (99% instead of 95%)WiderLowerHigher
Larger sampleNarrowerHigherSame
Larger SD (noisier data)WiderLowerSame

Correct meaning of a 95% CI

  • If the study were repeated many times, about 95% of such intervals would contain the true value
  • The sample result sits at the center of its own interval
  • A narrower interval means a more precise estimate

Reading intervals for ratios and differences

Measure'No effect' valueCI crossing it means
Relative risk, odds ratio1.0Not statistically significant
Difference between means or risks0Not statistically significant
  • Example: RR 1.8 with CI 1.2 to 2.6
  • Interval excludes 1.0, so significant increase
    • About 80% higher risk
  • Example: RR 1.4 with CI 0.9 to 2.1
  • Interval includes 1.0, so not significant
    • Example: RR 0.7 with CI 0.5 to 0.9
    • Interval excludes 1.0, so significant protection
      • 30% lower risk (1 − 0.7)
    • Rule of thumb for comparing two group means: intervals that do not overlap indicate a significant difference
    • Overlap usually means not significant, but a formal test is more exact

    Why a CI beats a lone p-value

    • It shows the size of the effect.
    • It shows how precise the estimate is.
    • It also shows significance, by whether it crosses the no-effect value.

    Exam traps

    • Higher confidence means a wider, less precise interval.
    • A CI that contains 1.0 for a ratio is not significant.
    • SE, not SD, goes into the CI formula.

    ⚖️ Hypothesis Testing Step by Step

    decision rules
    • Where this fits: a test asks whether chance alone could plausibly explain the sample result
    State question→Set null and alternative→Choose alpha→Collect data and run test→Compare p with alpha→Decide

    Null and alternative hypotheses

    HypothesisSaysExample
    Null (H0)No effect or no difference; findings are due to chanceThe new drug lowers blood pressure no more than placebo
    Alternative (H1)A real effect or difference existsThe new drug lowers blood pressure more than placebo
    • The null is built to be the claim researchers hope to disprove
    • We try to reject the null, never to prove it

    One-tailed versus two-tailed

    TypeLooks forNull wording example
    One-tailedDifference in a single, pre-stated directionThe program does not lower the rate (any lower than the comparison)
    Two-tailedDifference in either directionThe two groups are equal
    • Two-tailed is the default when direction is not stated
    • A one-tailed null is a one-direction statement of no effect

    The p-value

    • Computed from the data using the right test
    • Definition: chance of a result at least this extreme if the null hypothesis were true
    • Small p means the data would be surprising under the null
    • Alpha is the cutoff chosen before the study; usually 0.05
    • Decision rule:
      • p ≤ alpha: reject the null (statistically significant)
      • p > alpha: fail to reject the null (not significant)
    • Example: p = 0.02 with alpha 0.05, so reject the null
    • Example: p = 0.13 with alpha 0.05, so fail to reject the null
    • Failing to reject means evidence is insufficient, not that the drug is useless

    Everyday analogy: a courtroom

    • The null hypothesis is 'innocent until proven guilty'.
    • The data are the evidence.
    • The verdict is 'guilty' (reject) or 'not guilty' (fail to reject).
    • 'Not guilty' does not mean proven innocent.

    What a p-value does and does not say

    It tells youIt does not tell you
    Whether chance alone is an unlikely explanationProbability that an individual patient will benefit
    Statistical significanceClinical importance or size of benefit
    Fit with the decision ruleProbability that the null hypothesis is true

    Exam traps

    • The null hypothesis is never 'accepted'; it is rejected or not rejected.
    • A significant p-value does not mean a large or useful effect.
    • If you do not reject the null, a type I error cannot occur.
    • If you reject the null, a type II error cannot occur.
    • Always read the p-value, not the test statistic, when deciding significance.

    🚨 Errors and Statistical Power

    decision risk
    • Where this fits: every test decision can still be wrong; there are two ways to be wrong
    Truth: effect is realTruth: no real effect
    Test says significant (reject null)Correct: power (1 − β)Type I error (α)
    Test says not significant (fail to reject)Type II error (β)Correct

    Type I error (alpha, false alarm)

    • Rejecting a null that is actually true
    • Claiming a drug works when it does not
    • Probability = alpha, the chosen cutoff
    • With alpha 0.05:
      • 5 in 100 true nulls would be wrongly rejected
      • 1 in 20
    • With alpha 0.01: 1 in 100
    • Conclusion is statistically significant but not real

    Type II error (beta, missed finding)

    • Failing to reject a null that is actually false
    • Claiming a drug does not work when it does
    • Chance is beta
    • Cannot be read directly from the p-value
    • Often caused by too small a sample

    Power

    • Definition: chance of detecting a real effect
    • Power = 1 − β
    • Usual goal: at least 80%
    • Example: a researcher wants a 90% chance of detecting a true 30% risk reduction
    • This is specifying power
      To raise powerWhy it works
      Increase sample sizeLowers the standard error
      Target a larger effectBig differences stand out from noise
      Reduce variability (better measurement)Less noise
      Raise alpha (for example 0.10)Easier to call significant, but more false alarms
      Smaller alpha→Fewer type I errors→More type II errors→Lower power

      Everyday analogy: a smoke detector

      • A very sensitive detector rarely misses a fire but often beeps for toast (more type I).
      • A dull detector rarely false-alarms but may miss a fire (more type II).
      • Power is how reliably it catches real fires.

      Exam traps

      • Type I = false positive; type II = false negative.
      • Power and type II error move in opposite directions.
      • A larger sample is the most common way to increase power.
      • With a significance cutoff of 0.01, the chance of a type I error is 1 in 100.

      📈 Correlation and Regression

      relationships
      • Where this fits: when both measurements are numbers, we ask how they move together

      Correlation coefficient (r)

      • Ranges from −1 to +1
      • Sign gives direction; size gives strength
      • Looks only for straight-line relationships
      r valueMeaningScatterplot pictureExample
      +1Perfect positiveDots on a rising line—
      +0.7Strong positiveTight upward bandHours studied and exam score
      +0.2Weak positiveLoose upward cloud—
      0No linear linkShapeless cloudShoe size and blood pressure
      −0.7Strong negativeTight downward bandAge and reaction speed
      −1Perfect negativeDots on a falling line—
      • Positive: both rise together
      • Negative: one rises as the other falls
      • Further from zero means stronger link

      Two kinds of correlation

      TestData typeUse
      PearsonTwo interval or ratio variablesStraight-line relationship
      SpearmanTwo ordinal variables, or skewed numeric dataRank-based relationship
      • r² shows the share of variation explained
      • Example: r = 0.5 means 25% of the variation is shared

      Regression

      • Fits a line to predict one measurement from another
      • Straight-line regression predicts a numeric outcome
      • Logistic regression predicts a yes-or-no outcome
      • Regression lets you adjust for several factors at once

      Why correlation is not causation

      • A link can be due to a third factor.
      • Example: ice cream sales and drowning both rise in summer.
      • A link can run the other direction.
      • Only well-designed experiments can support causal claims.

      Exam traps

      • A correlation near zero does not prove there is no relationship; the link may be curved or masked by measurement error.
      • The correlation number is not a p-value.
      • Avoid answer choices that claim one variable causes the other.

      🧪 Choosing the Right Statistical Test

      algorithm
      • Where this fits: the type of data and number of groups decide the test

      Decision path

      Outcome is a category?→Yes→Chi-square
      Outcome is a number, 2 groups?→Yes→t-test (paired if linked)
      Outcome is a number, 3+ groups?→Yes→ANOVA
      Two numbers, one per person?→Yes→Correlation
      TestGroups / variablesOutcome dataQuestion answered
      Pearson correlationTwo numeric variablesInterval or ratioIs there a straight-line link?
      Chi-squareAny number of groupsNominal (counts)Are the categories related?
      t-test (unpaired)Exactly 2 independent groupsInterval or ratioDo two means differ?
      Paired t-test2 linked measurements (before and after, spouses, matched pairs)Interval or ratioDo paired means differ?
      One-way ANOVA3 or more groups, one grouping factorInterval or ratioDo any means differ?
      Two-way ANOVAGroups from 2 grouping factorsInterval or ratioDo either factor or their combination matter?
      Repeated-measures ANOVASame people measured 3 or more timesInterval or ratioDo means change over time?

      t-test

      • Compares two means
      • Test statistic: t = difference in means ÷ standard error of the difference
      • Unpaired: separate groups
      • Paired: each person acts as their own control

      ANOVA

      • Produces an F statistic
      • F = variation between groups ÷ variation within groups
      • Significant result means at least one group differs
      • It does not say which groups differ
      • Follow-up comparisons identify the specific groups
      • Why not many t-tests: repeated testing inflates type I error

      Chi-square

      • Tests whether two categorical variables are independent
      • Compares observed counts with the counts expected if there were no link
      • Works for 2×2, 2×3, 3×3 tables and larger
      • Small expected counts: use an exact test instead
      • Worked example: 120 patients, 60 per group
      • Recovered: 42 on new treatment, 30 on placebo
      • Total recovered = 72; not recovered = 48
      • Expected if no effect: 36 recovered and 24 not in each group
        • Chi-square = (42−36)²/36 + (18−24)²/24 + (30−36)²/36 + (30−24)²/24
          • = 1 + 1.5 + 1 + 1.5 = 5.0
        • Critical value for 1 degree of freedom at 0.05 is 3.84
          • 5.0 is larger, so p < 0.05 and the null is rejected

        Default pairings to remember

        • Two numbers per person: correlation.
        • Two categories: chi-square.
        • A category plus a number: t-test or ANOVA.

        Matching situations to tests

        SituationTestWhy
        Compare blood sugar of husbands and wivesPaired t-testSpouses are linked pairs
        Compare sick-leave yes or no across 3 shiftsChi-squareTwo categorical variables
        Study hours versus exam scorePearson correlationTwo numeric variables
        Testosterone in boys with or without same-sex siblingsUnpaired t-testTwo groups, numeric outcome
        Quality of life scores after 3 different treatmentsOne-way ANOVAThree groups, numeric outcome
        Blood pressure before and after a drug in the same patientsPaired t-testLinked measurements
        Effect of treatment and training on task timeTwo-way ANOVATwo grouping factors, numeric outcome
        Cancer versus no cancer by exposure group (counts)Chi-squareTwo categorical variables

        Exam traps

        • Linked or before-and-after data need a paired test.
        • Counting people in categories always points to chi-square.
        • Three or more means need ANOVA, not repeated t-tests.

        ✅ Recap

        final

        Most important facts

        • A sample result is only an estimate of the population value.
        • SE = SD ÷ √n; bigger samples shrink the SE.
        • 95% CI ≈ result ± 1.96 × SE; 99% CI uses 2.58.
        • Higher confidence gives a wider, less precise interval.
        • A ratio CI containing 1.0 is not significant; a difference CI containing 0 is not significant.
        • The null hypothesis says findings are chance.
        • We reject or fail to reject the null; we never accept it.
        • p ≤ 0.05 means reject the null by the usual rule.
        • A p-value is not the probability that the null is true.
        • Type I error: false alarm, probability = alpha.
        • Type II error: missed effect, probability = beta.
        • Power = 1 − β; more sample size raises power.
        • Correlation runs −1 to +1 and does not prove cause.
        • t-test: 2 means; paired t-test: linked measurements.
        • ANOVA: 3 or more means; chi-square: counts in categories.
        • Case-control uses odds ratio; cohort uses relative risk.