Confidence Intervals Explorer

shore.org.uk/resources/confidence-intervals

The Confidence Intervals Explorer is an interactive visualisation designed to bridge the gap between calculating a margin of error and truly understanding what a confidence interval represents. By simulating both individual samples and long-run repetitions, the tool confronts common misconceptions about probability and the frequentist interpretation of statistics.

The tool is split into two functional areas:

  • Single Sample View: Visualise how individual data points and sample size determine the width of a single interval.
  • Multiple Confidence Intervals (Long-run Performance): A collapsible module to simulate multiple samples (\(N\)) to see the "capture rate" in action against the true population mean.

How the Tool Works

The interface is built around a dynamic Normal distribution curve representing the population. Users control the "ingredients" of the interval, Confidence Level and Sample Size (\(n\)), and watch the interval react in real-time.

  • The Main Plot: Displays the population curve with the true mean (\(\mu\)) as a fixed vertical dashed line. When the "Sample" button is clicked, individual data points appear on the x-axis, and the resulting confidence interval is drawn as a horizontal blue band centred on the sample mean (\(\bar{x}\)).
  • Long-run Performance: Accessed via the "Multiple Confidence Intervals" dropdown. This section stacks generated intervals vertically, allowing students to see which intervals "capture" the population mean and which "miss" it.

Parameters & Layers

The control bars allow for precise adjustment of the statistical model:

  • Confidence Level: Adjust from 0% to 100% to see how the "certainty" affects the width of the interval.
  • Sample Size (\(n\)): Observe the inverse relationship between \(n\) and the margin of error.

The Layers toggles are split into two sections to allow teachers to manage visual complexity:

  1. Main Plot Layers: Toggle Sample points, Sample mean, Population curve/mean, the CI band, and x-axis ticks.
  2. Multiple Interval Layers: Control the display of the population mean, filter for intervals that "contain" or "miss" \(\mu\), and use the "Highlight top interval" feature to focus on the most recent sample.

Key Visualisations

1. The Single Sample Logic

What it does: By clicking "Sample," a new set of \(n\) points is generated. The tool calculates \(\bar{x}\) and constructs the interval \([\bar{x} - E, \bar{x} + E]\).

Why this is powerful: It makes "sampling error" visible. Students can see that while the population mean \(\mu\) is fixed, the sample mean \(\bar{x}\) (and its associated interval) "dances" around the centre with every new sample. It moves the focus away from a static formula and onto the randomness of the sampling process.

2. Long-run CI Performance (Stacking)

What it does: This section allows users to generate multiple intervals (up to \(N=100\)) simultaneously. The tool colours intervals that contain the population mean blue and those that miss it red.

The Capture Rate: A live readout (e.g., "Captured \(\mu\): 24 out of 25 (96%)") provides immediate quantitative feedback. This demonstrates that a 95% confidence level refers to the reliability of the process over time, rather than a probability for one specific interval.

Classroom Uses

The Trade-off Discovery: Keep the sample size \(n\) constant and move the Confidence Level slider. Discuss why we need a "wider net" (larger interval) to be more confident that we’ve captured the true mean.

The Power of \(n\): Set the confidence level to 95% and vary the sample size. This visually demonstrates the "Law of Large Numbers." As \(n\) increases, the estimate becomes more precise and the interval shrinks, despite the confidence level remaining the same.

Visualising "Misses": Generate 100 intervals at a 90% confidence level. Ask the class to count how many intervals failed to cross the central \(\mu\) line. The live "Captured \(\mu\)" counter makes the abstract \(10\%\) significance level a concrete, visible reality.

Bridging the Gap: Use the "Highlight top interval" toggle in the stacking view. This shows students exactly how the single sample they see in the top plot corresponds to the "long-run" list below, helping them connect individual results to the broader statistical theory.

Pedagogical Roots

The tool aligns with the work of researchers like Gerd Gigerenzer and Clifford Konold, who argue that statistical "literacy" requires a move away from "probability as a single-event state" toward "probability as a long-run frequency."

By using dynamic variation, where the user changes one parameter (\(n\) or %) and sees the visual result instantly, the app helps students develop an intuitive "feel" for the standard error. It moves the confidence interval from being a "thing you calculate" to a "process you trust."

confidenceintervels2


Topic Tags: population
← Back to Statistics