AI Grounds

Open AI Grounds on a desktop

These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.

Guided discovery

Margin of Error & Sample Size Lab

Trade sample size against confidence and interval width.

Assume independent normal observations and known population SD 4. The population mean is unknown. This planning view holds an illustrative sample mean at 20; changing settings does not generate new samples.

Hypothetical observation count used in the standard-error formula. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Selected repeated-procedure coverage under the declared model. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Known SD 4; sample size 25; confidence 95%; illustrative sample mean 20.

Same center, different margins

The fixed value axis and shared center expose width changes. Reference uses n = 25 and 95% confidence with the currently selected SD 4; it is a comparison rule, rather than a previous sample.

Reference · n 25 · 95%Current · n 25 · 95%-5515253545Value · interval for the population mean

Reference: [18.4320, 21.5680]; margin 1.5680; full width 3.1359.

Current: [18.4320, 21.5680]; margin 1.5680; full width 3.1359.

E = z* × σ / √n = 1.9600 × 4 / √25 = 1.5680. Full width = 2E = 3.1359.

Margin is half-width, not a guaranteed bound on realized estimation error. Confidence describes the repeated interval procedure under the model.

Sample SE

Theoretical spread of sample means.

0.8000

σ / √n = 4 / √25

Margin of error

Half-width; actual error is unknown.

1.5680

E = 1.9600 × 0.8000

Full interval width

Twice the margin, in the same units.

3.1359

2E = 2 × 1.5680

Model assumptions and interpretation

Independent normal observations, a fixed unknown population mean and a known positive population SD give a normally distributed sample mean with SE σ / √n at every n. The two-sided interval uses the positive standard-normal critical distance z* for central probability 95%, leaving 2.5% in each tail. Numerical critical values invert the Abramowitz–Stegun 26.2.17 normal-tail approximation.

Before collecting data, this rule captures the fixed true mean in 95% of repeated samples under the model, up to numerical approximation. After one interval is computed, the fixed true mean either lies inside it or does not; this frequentist confidence level is not a posterior probability for that realized interval. It does not describe the fraction of individual observations within the interval. E is a procedure’s half-width, not the observed error or a guaranteed bound on every error.

The sample mean here stays at 20 to isolate planning tradeoffs. Real new samples may move the center; this lesson generates none. The normal known-SD formula cannot simply be substituted for unknown-SD t intervals or applied universally to dependent, biased or non-normal small samples. Repeated simulated coverage is reserved for the following Confidence Intervals Explorer.

NIST · Known-SD normal intervals and confidence interpretation
Sample-size planning example

For desired margin at most 0.5 with confidence 95% and known SD 4: n ≥ (z* × σ / E)². Round up: n = ceil((1.9600 × 4 / 0.5)²) = 246.

This required size is inside the displayed range. This plans interval half-width under the model; it does not guarantee every realized error is at most 0.5. Halving the target margin multiplies the unrounded required size by four; integer rounding can alter the exact count ratio.

NIST · Sample-size planning with known spread