Confidence Interval Calculator
Calculate a 90%, 95% or 99% confidence interval for a mean, a proportion, the difference between two groups or a standard deviation. Paste comma-separated data or upload a CSV, and get the margin of error, the sample size you need, four charts, every step of the working and ready-to-copy results for your research paper.
⚡ 0. Quick Answer
A confidence interval calculator finds a range of plausible values for a population value: the mean plus or minus the margin of error, where the margin is the critical value times the standard error.
For 16 leaf lengths with mean 52.44 mm and SD 4.19 mm, the standard error is 4.19 ÷ √16 = 1.049, t* for 95% with 15 degrees of freedom is 2.131, so the margin of error is 2.235 and the 95% confidence interval is 50.20 to 54.67 mm. More data makes it narrower. A higher confidence level makes it wider.
Rule of thumb: use z = 1.645 for 90%, 1.960 for 95% and 2.576 for 99% when n is large. With n under 30 and an unknown SD, use t instead. For proportions, use the Wilson interval, not the textbook Wald formula, whenever np or n(1 − p) is below 10.
Key takeaways
- This confidence interval calculator handles 5 cases: a mean from raw data, a mean from summary numbers, one proportion, two proportions and the sample size you need.
- A 95% confidence interval means the method captures the true value in 95 of every 100 repeated samples, not that this one interval has a 95% chance.
- The margin of error shrinks with the square root of n, so you need 4 times the data to halve the width.
- For a proportion of 42 out of 120, the Wilson 95% interval is 27.1% to 43.9%, and it stays valid even with 0 events, where the Wald formula fails.
- If a 95% interval for a difference excludes 0, the matching two-sided test gives p < 0.05.
📚 1. What Is a Confidence Interval?
A confidence interval (CI) is a range of values, worked out from a sample, that is likely to contain the true value for the whole population. You almost never measure every member of a population, so the sample mean or sample proportion is only an estimate. The confidence interval puts honest error bars around that estimate.
What it measures: precision. A narrow interval says the sample pins the population value down tightly. A wide interval says the data are too few or too variable to say much. Every interval has the same three parts:
- Point estimate, your best single guess, such as the sample mean x̄ or the sample proportion p̂.
- Standard error, how much that estimate would wobble from sample to sample.
- Critical value, a multiplier from the t, z, chi-square or beta distribution chosen by your confidence level.
The margin of error is the critical value times the standard error. The interval is the estimate minus the margin to the estimate plus the margin.
A worked one-liner: 42 of 120 survey respondents said yes, so p̂ = 0.35. The Wilson 95% interval is 0.271 to 0.439, so the true share of yes answers in the population is plausibly anywhere from about 27% to 44%.
Who uses it: doctors report the 95% CI for a treatment effect, pollsters call the margin of error "plus or minus 3 points", ecologists put intervals around population density, engineers use them for tolerance limits, and every major journal style guide, including APA 7th, now asks for intervals beside p-values.
| Confidence interval | Hypothesis test (p-value) | |
|---|---|---|
| Question answered | How big is the effect, and how precisely do we know it? | Is the effect different from one null value? |
| Output | A range in the original units, such as 50.2 to 54.7 mm | A probability, such as p = 0.03 |
| Shows effect size | Yes, directly | No, a tiny effect can give a tiny p |
| Link | A 95% two-sided interval that excludes the null value matches p < 0.05 for the same test | |
🧮 2. Set Up Your Data
Each box is one group (cluster). Type numbers separated by commas, spaces, tabs or new lines. Rename any group by clicking its name.
Type one value per cell. Each column becomes a cluster. Empty cells are ignored, so groups can have different sizes.
📊 3. Results
🧠 4. Interpretation of Results, In Detail
4.5 The correct way to read "95% confidence"
The 95% belongs to the method, not to your single interval. If you repeated your study many times and built an interval each time in the same way, about 95% of those intervals would contain the true population value. Your interval either contains it or it does not. You just do not know which.
So the safe sentence is: "We are 95% confident that the population mean lies between 50.2 and 54.7 mm." The risky sentence is: "There is a 95% probability that the true mean is between 50.2 and 54.7 mm." The second one is a Bayesian credible interval statement. Most reviewers will accept the first and query the second.
4.6 What the interval does not say
A 95% interval for the mean is not the range that holds 95% of the individual values. That range, called a prediction or reference interval, is far wider, roughly the mean plus or minus 2 standard deviations. For the leaf data, the 95% prediction interval for one new leaf runs from about 43.2 to 61.7 mm, while the 95% confidence interval for the mean is only 50.2 to 54.7 mm. Mixing the two up is the most common mistake in student reports.
It also does not say that values in the middle are much more likely than values near the ends in any strict sense, and it says nothing about bias. A biased sample gives a narrow interval around the wrong value.
4.7 Margin of error, width and precision
The margin of error is half the width of a two-sided interval. Width depends on three things only: the spread of the data (s or p(1 − p)), the sample size n, and the confidence level. Because the standard error divides by √n, doubling the sample size only cuts the width by about 29%. Halving the width needs four times as many observations. Chart 4 shows this curve for your own data.
A handy way to judge precision is the relative margin: margin divided by the estimate. Under 5% is usually called high precision, 5% to 10% moderate, and above 10% low. The calculator gives this as a verdict badge.
4.8 Choosing the confidence level
95% is a convention, not a law. A 90% interval is narrower and is used when a one-sided 5% test is the real question, as in bioequivalence work. A 99% interval is wider and is used when a wrong claim would be costly, as in safety limits. Whatever you choose, choose it before you see the data and report it. Changing from 95% to 90% after seeing that the 95% interval crossed zero is a form of p-hacking.
4.9 Using the interval as a test
A two-sided 95% interval contains exactly the null values that a two-sided test at α = 0.05 would not reject. So if the interval for a difference in means excludes 0, the t-test gives p < 0.05. If the interval for a proportion excludes 0.5, a test against 50% would be significant. The interval is more useful than the p-value because it also shows the size of the effect and every value the data are compatible with.
4.10 Overlapping intervals do not mean "no difference"
Two group intervals can overlap a little while the difference between the groups is still significant. When two 95% intervals overlap by less than about half of one margin of error, the difference is usually significant at about p < 0.05. The only reliable check is the interval for the difference itself, which this calculator gives whenever you enter two or more clusters.
4.11 Why the method matters for proportions
The textbook Wald formula, p̂ ± z√[p̂(1 − p̂)/n], gives intervals that are too short when n is small or p is near 0 or 1. Its real coverage can fall well below 95%, and with 0 events it gives a zero-width interval, which is plainly wrong. Brown, Cai and DasGupta (2001) showed this in detail and recommend the Wilson or Jeffreys interval. Clopper-Pearson is called "exact" because it guarantees at least 95% coverage, which also makes it wider than necessary. This tool defaults to Wilson for one proportion and Newcombe's method for a difference.
4.12 Small samples and skewed data
The t interval for a mean assumes the sampling distribution of the mean is close to normal. With n of 30 or more this holds for most data, thanks to the central limit theorem. With small samples, check the Shapiro-Wilk result and Chart 2. If the data are strongly skewed, the calculator also gives a distribution-free interval for the median, which needs no normality at all, and you may prefer to report that instead.
4.13 One-sided bounds
A one-sided lower bound answers "at least how large?". For example, "we are 95% confident the mean strength is at least 210 MPa". It uses t at 1 − α instead of 1 − α/2, so for the same data it sits closer to the estimate than the lower end of the two-sided interval. Only use it when the direction was fixed before the data were seen.
4.14 Practical judgement
Look first at where the whole interval sits, not just at the estimate. If every value in the interval would lead to the same practical decision, the result is conclusive even if it is wide. If the lower end means "no real effect" and the upper end means "a large effect", the study is inconclusive and the honest next step is more data, which the sample size option in Section 2 can plan for you.
✍ 5. How to Write Your Results in Research
When reporting confidence interval calculator results in APA format, give the estimate first, then the confidence level, then the lower and upper limits in square brackets with the units. APA 7th writes it as M = 52.44, 95% CI [50.20, 54.67].
▶ Run the analysis above to auto-fill all five examples with your results.
📌 Key conventions for this style
- Write "95% CI" before the brackets and use square brackets: [lower, upper].
- Use the same decimal places for the estimate and both limits.
- Italicise statistical symbols: M, SD, n, t.
- Do not repeat the units inside the brackets if they follow the estimate.
- Report the interval for the difference, not just one interval per group, when comparing groups.
📌 Key conventions for this style
- Name the method: t interval, z interval, Wilson score, Clopper-Pearson, Welch.
- Give the degrees of freedom and the critical value in the methods chapter.
- Say how normality was checked, and what you did if it failed.
- State the confidence level was fixed in advance.
📌 Key conventions for this style
- Say "plus or minus" or "between ... and ...". Avoid "CI".
- Give units every time.
- Do not say "95% chance". Say "we are fairly confident".
- Mention the sample size in words.
📌 Key conventions for this style
- Use "to" instead of a dash inside abstracts so negative limits are clear.
- On a poster, show the interval as an error bar and say "error bars are 95% CIs" in the legend.
- Keep one decimal place more than the raw data, no more.
📌 Key conventions for this style
- Pre-register the target margin of error, not only power.
- Name the exact interval method and the software.
- Say how missing values and outliers will be handled.
- Report the interval whatever it shows.
5.1 Methods wording
Name the estimate, the interval method, the confidence level and the software: "Means are reported with two-sided 95% confidence intervals based on the t distribution with n − 1 degrees of freedom. Proportions are reported with Wilson score intervals. Analyses used the StatsUnlock Confidence Interval Calculator and were checked in R 4.4."
5.2 Results sentence
Lead with the estimate and the interval together, never the interval alone: "Mean leaf length was 52.44 mm, 95% CI [50.20, 54.67]." For a difference: "Treatment lowered systolic pressure by 9.67 mmHg relative to placebo, 95% CI [7.15, 12.19]." That is the Drug Trial sample dataset in the calculator, with the Welch interval.
5.3 Tables and figures
In a table, add a column headed "95% CI" with entries like "50.20 to 54.67". In a figure, draw the interval as an error bar and write in the caption that the bars are 95% confidence intervals, not standard deviations or standard errors. Unlabelled error bars are one of the most common reasons for revision (Cumming, Fidler and Vaux, 2007).
5.4 Discussion sentence
Interpret both ends of the interval. For a wider interval of 3 to 13 mmHg you might write: "The data are compatible with a reduction as small as 3 mmHg, which is of little clinical value, or as large as 13 mmHg, which would be important. A larger trial is needed to narrow this range."
5.5 Reporting checklist
- Estimate, confidence level and both limits are given together.
- Interval method named (t, z, Wilson, Clopper-Pearson, Welch, Newcombe).
- n, and for means the SD, are reported.
- One-sided bounds are labelled as one-sided.
- Error bars in figures are labelled as confidence intervals.
- For a group comparison, the interval for the difference is given.
∑ 6. Formulas Used
🔀 7. Confidence Interval Calculation Flowchart, Step by Step
This flowchart shows how to calculate a 95% confidence interval for a mean, step by step, from a raw column of numbers to the final lower and upper limits. Every box uses the same worked example as the Excel, R and Python sections: 16 leaf lengths measured to the nearest millimetre in a botany practical.
Check any box yourself: the Excel sheet in Section 9, the R script in Section 10 and the Python script in Section 11 all return a mean of 52.4375 and a 95% confidence interval of 50.2023 to 54.6727 for this dataset.
📝 8. How to Use This Confidence Interval Calculator
- Choose what you need an interval for. Pick a mean from raw data, a mean from summary numbers, one proportion, two proportions, or the sample size for a target margin of error.
- Enter your data. In the default tab type comma-separated numbers exactly as the placeholder shows:
52, 48, 55, 61, 47, .... Spaces, tabs, semicolons and new lines also work, so a column pasted from Excel is fine. - Name each group. Click the group name above each box and type, for example Placebo or Site A. The name flows into the tables, charts and report.
- Add more groups if you want to compare. Press Add cluster. Every extra cluster also gets an interval for its difference from the first cluster.
- Or upload a file. On the Upload tab choose a CSV or Excel file, then click each column you want. Every column you select becomes its own cluster.
- Pick the confidence level. 95% is the usual choice. 90%, 99% and any custom level such as 93% are also available.
- Choose two-sided or one-sided. Two-sided gives a lower and an upper limit. One-sided gives only an "at least" or "at most" bound.
- Press Calculate Confidence Interval. Nothing is computed before you do, and changing any input clears old results so you never read stale numbers.
- Read the result and the checks. The top card gives the interval, the cards give the margin of error, standard error and critical value, and the checks table tells you if normality or the success-failure rule is a problem.
- Copy or download. Section 5 fills five ready-to-paste report styles. The buttons save a text report or a print-ready PDF with the full working.
8.1 How to calculate a confidence interval on a TI-84
- Press
STAT, chooseEDIT, and type your data into listL1. - Press
STAT, move right toTESTS. - For a mean with unknown σ choose
8:TInterval. For a known σ choose7:ZInterval. For a proportion chooseA:1-PropZInt. For two proportions chooseB:2-PropZInt. - Select
Dataif your values are in L1, orStatsto type x̄, Sx and n directly. - Set
C-Levelto.95, highlightCalculateand pressENTER.
For the leaf data the TI-84 TInterval shows (50.202, 54.673), the same as this calculator. Note that the TI-84 1-PropZInt uses the Wald formula, so for 42 of 120 it returns (0.2647, 0.4353), which matches the "Wald" row of this tool, not the recommended Wilson row.
📈 9. How to Calculate a Confidence Interval in Excel
Excel can calculate a 95% confidence interval for a mean in one formula, but the function returns only the margin of error, not the interval. That trips up nearly everyone the first time. You also need to pick between CONFIDENCE.T and CONFIDENCE.NORM, and Excel has no built-in function for a proportion interval at all. This section shows the whole sheet step by step.
=CONFIDENCE.T(0.05,STDEV.S(A2:A17),COUNT(A2:A17)). Subtract it from and add it to =AVERAGE(A2:A17) to get the 95% confidence interval.9.1 The functions you need
| You want | Excel function | Note |
|---|---|---|
| Mean | =AVERAGE(A2:A17) | Ignores blanks and text |
| Sample SD | =STDEV.S(A2:A17) | Uses n − 1. Never STDEV.P for a sample |
| n | =COUNT(A2:A17) | COUNT, not COUNTA, which counts the header |
| Standard error | =STDEV.S(A2:A17)/SQRT(COUNT(A2:A17)) | No built-in SE function |
| t critical value | =T.INV.2T(0.05,COUNT(A2:A17)-1) | Two-tailed, returns 2.1314 for df 15 |
| z critical value | =NORM.S.INV(0.975) | Returns 1.9600 |
| Margin of error, t | =CONFIDENCE.T(0.05,sd,n) | Returns the margin, not the interval |
| Margin of error, z | =CONFIDENCE.NORM(0.05,sigma,n) | Only when σ is known |
| Chi-square for the SD interval | =CHISQ.INV(0.025,15) and =CHISQ.INV.RT(0.025,15) | Lower and upper quantiles |
| Exact binomial limits | =BETA.INV(0.025,x,n-x+1) | Clopper-Pearson lower limit |
CONFIDENCE.T and the older CONFIDENCE both return the margin of error, the half-width. If you report that number as "the confidence interval" you have reported the wrong thing. Also, CONFIDENCE and CONFIDENCE.NORM use z, which is too narrow for small samples. For the leaf data CONFIDENCE.NORM gives 2.0554, while the correct CONFIDENCE.T gives 2.2352.9.2 Step by step
1 Put your numbers in one column
Paste the values down column A with a label in row 1. Blank cells are skipped, but a zero is counted as a real value, so never use 0 for missing data.
The 16 leaf lengths sit in A2:A17. Only the first eight rows are shown.
2 Mean, SD and n
Type the statistic names in column B and the formulas in column C.
=AVERAGE(A2:A17)=STDEV.S(A2:A17)=COUNT(A2:A17)C2 holds the mean 52.4375, C3 the SD 4.1947 and C4 the count 16.
3 Standard error, t value and margin of error
=C3/SQRT(C4)=T.INV.2T(0.05,C4-1)=C6*C5The margin in C7 is exactly what =CONFIDENCE.T(0.05,C3,C4) returns, so you can use either.
SE 1.0487 in C5, t* 2.1314 in C6 and margin of error 2.2352 in C7.
4 The lower and upper limits
=C2-C7=C2+C7The 95% confidence interval is 50.2023 (C8) to 54.6727 (C9), matching this calculator, R and Python.
5 A proportion, Wald and Wilson in Excel
Excel has no proportion interval function, so build it. With x in C2 and n in C3:
=C2/C3=NORM.S.INV(0.975)=(C4+C5^2/(2*C3)-C5*SQRT(C4*(1-C4)/C3+C5^2/(4*C3^2)))/(1+C5^2/C3)For 42 of 120, p̂ = 0.35 and the Wilson 95% interval is 0.2705 (C6) to 0.4388 (C7). Swap the minus before C5 for a plus to get C7.
9.3 The awkward cases
A one-sided bound. Use the one-tailed t: =C2-T.INV(0.95,C4-1)*C5 gives the 95% lower bound 50.5991. People often reuse T.INV.2T(0.05,...) here, which gives a 97.5% bound instead.
The Analysis ToolPak. Enable it first under File, Options, Add-ins, Manage Excel Add-ins, Analysis ToolPak. Then Data, Data Analysis, Descriptive Statistics, tick Confidence Level for Mean. The row it prints, "Confidence Level(95.0%)", is again the margin of error (2.2352), not the interval.
Difference between two means (Welch). With group 1 in A and group 2 in B: margin =T.INV.2T(0.05,df)*SQRT(VAR.S(A2:A11)/COUNT(A2:A11)+VAR.S(B2:B11)/COUNT(B2:B11)), where df is the Welch formula from card 6 in Section 6. Excel does not compute Welch df for you; T.TEST(...,2,3) gives only the p-value.
Exact Clopper-Pearson limits. =BETA.INV(0.025,42,79) returns 0.2652 and =BETA.INV(0.975,43,78) returns 0.4424. Wrap each in IF to return 0 when x = 0 and 1 when x = n.
9.4 Why your Excel answer might differ from R or Python
| Situation | What happens | Fix |
|---|---|---|
Used CONFIDENCE.NORM | z = 1.960 instead of t = 2.131, so the interval is about 8% too narrow at n = 16 | Use CONFIDENCE.T |
Used STDEV.P | SD divides by n, so the interval is too narrow | Use STDEV.S, like R sd() |
| Blank versus zero cells | Blanks are skipped, zeros counted, so n and the mean change | Check COUNT first |
Proportion from Python proportion_confint | statsmodels defaults to Wald ("normal"); R prop.test gives Wilson with continuity correction | Name the method: method="wilson", correct=FALSE |
| Two-group interval from R | R t.test defaults to Welch; SciPy ttest_ind defaults to pooled Student; Excel needs you to choose | Set var.equal or equal_var explicitly and say which |
| Rounded t value from a printed table | 2.13 instead of 2.1314 shifts the limits in the third decimal | Use T.INV.2T, not a table |
| Tool | 95% CI for a mean | 95% CI for a proportion |
|---|---|---|
| Excel | AVERAGE ± CONFIDENCE.T(0.05,sd,n) | Build Wilson by hand (step 5) |
| Google Sheets | CONFIDENCE.T(0.05,sd,n) | Build by hand |
| R | t.test(x)$conf.int | prop.test(42,120,correct=FALSE)$conf.int |
| Python SciPy | stats.t.interval(0.95,df,loc,scale) | stats.binomtest(42,120).proportion_ci("wilson") |
| SPSS | Analyze, Descriptive Statistics, Explore, Statistics, Confidence Interval for Mean | |
| TI-84 | STAT → TESTS → TInterval | 1-PropZInt (Wald only) |
9.5 Charting the interval in Excel
- Put group names in one column and means in the next. Select both.
- Insert, Charts, Clustered Column (or a scatter if you prefer dots).
- Click the chart, press the + button, tick Error Bars, then More Options, Custom, Specify Value, and select your margin-of-error cells for both the positive and negative values.
- Write "Error bars show 95% confidence intervals" in the caption. Unlabelled bars are a common reason for journal revision.
- For two or more groups, a dot-and-whisker plot (scatter with error bars) is clearer than bars, because a bar suggests the data start at zero.
9.6 Excel errors you will probably hit
| Excel shows | Why | Fix |
|---|---|---|
#DIV/0! | Only one number in the range, so STDEV.S cannot be computed | A confidence interval needs at least 2 values |
#NUM! from CONFIDENCE.T | n is 1, sd is 0 or negative, or alpha is not between 0 and 1 | Check the inputs; alpha is 0.05, not 95 |
#NUM! from BETA.INV | x = 0 or x = n makes one shape zero | Set the lower limit to 0 or the upper to 1 by hand |
#VALUE! | Text such as "12 mm" in a cell | Move units into the header |
#NAME? | CONFIDENCE.T does not exist in Excel 2007 or older | Use T.INV.2T logic by hand, or update Excel |
| Interval looks far too narrow | Used STDEV.P or CONFIDENCE.NORM | Switch to STDEV.S and CONFIDENCE.T |
📈 10. How to Calculate a Confidence Interval in R
R gives you a 95% confidence interval for a mean in one line, t.test(x)$conf.int, but that line hides the margin of error, the critical value and every check a reviewer will ask about. The script below is complete and runnable. It builds the interval by hand and confirms it with t.test(), adds the intervals for the SD, the median and a proportion, prints a plain-English verdict, and saves one publication-ready figure at 300 dpi. It uses base R only.
Rscript. Change only the x <- c(...) line, and succ and trials for the proportion.10.1 The complete script
R, base only, saves confidence_interval.png
# ============================================================
# Confidence interval calculator: mean, SD, median and proportion
# StatsUnlock - https://statsunlock.com/confidence-interval-calculator/
# Base R only. No packages to install.
# ============================================================
# ---- 1. Your data ------------------------------------------
# Replace with your own values, or read a CSV:
# x <- read.csv("data.csv")$leaf_length
x <- c(52, 48, 55, 61, 47, 50, 58, 53,
49, 56, 51, 54, 46, 57, 50, 52)
x <- x[!is.na(x)] # drop missing values
conf <- 0.95
label <- "Leaf length"
units <- "mm"
# ---- 2. t interval for the mean ----------------------------
n <- length(x)
df <- n - 1
m <- mean(x)
s <- sd(x) # sd() always uses n - 1
se <- s / sqrt(n)
tcrit <- qt(1 - (1 - conf) / 2, df)
me <- tcrit * se
ci <- c(m - me, m + me)
tt <- t.test(x, conf.level = conf) # same interval in one line
# ---- 3. SD interval (chi-square) and median interval -------
chi <- qchisq(c(1 - (1 - conf) / 2, (1 - conf) / 2), df)
sd_ci <- sqrt(df * s^2 / chi)
xs <- sort(x)
ks <- 1:(n %/% 2)
ok <- ks[pbinom(ks - 1, n, 0.5) <= (1 - conf) / 2]
if (length(ok)) {
k <- max(ok)
med_ci <- c(xs[k], xs[n - k + 1])
cover <- 1 - 2 * pbinom(k - 1, n, 0.5)
}
sw <- shapiro.test(x)
# ---- 4. Proportion interval (Wilson and exact) -------------
succ <- 42; trials <- 120
wil <- prop.test(succ, trials, conf.level = conf, correct = FALSE)$conf.int
cp <- binom.test(succ, trials, conf.level = conf)$conf.int
# ---- 5. Print the results ----------------------------------
rel <- me / abs(m) * 100
cat(sprintf("n = %d, df = %d\n", n, df))
cat(sprintf("mean = %.4f, SD = %.4f, SE = %.4f\n", m, s, se))
cat(sprintf("t* = %.4f, margin of error = %.4f\n", tcrit, me))
cat(sprintf("%.0f%% CI for the mean: %.4f to %.4f\n", conf * 100, ci[1], ci[2]))
cat(sprintf("t.test() agrees: %.4f to %.4f\n", tt$conf.int[1], tt$conf.int[2]))
cat(sprintf("%.0f%% CI for the SD: %.4f to %.4f\n", conf * 100, sd_ci[1], sd_ci[2]))
if (length(ok)) cat(sprintf("CI for the median: %g to %g (exact coverage %.1f%%)\n",
med_ci[1], med_ci[2], cover * 100))
cat(sprintf("Shapiro-Wilk W = %.4f, p = %.4f\n", sw$statistic, sw$p.value))
cat(sprintf("Proportion %d/%d = %.4f\n", succ, trials, succ / trials))
cat(sprintf(" Wilson %.4f to %.4f; exact %.4f to %.4f\n", wil[1], wil[2], cp[1], cp[2]))
verdict <- if (rel < 5) "high" else if (rel < 10) "moderate" else "low"
cat(sprintf("Verdict: the margin of error is %.1f%% of the mean, so precision is %s.\n",
rel, verdict))
if (n < 30 && sw$p.value < 0.05)
cat("Warning: small sample and non-normal data, prefer the median interval.\n")
# ---- 6. One figure, two panels -----------------------------
png("confidence_interval.png", width = 3000, height = 1500, res = 300)
par(mfrow = c(1, 2), mar = c(4.5, 4.8, 3.2, 1), family = "sans")
set.seed(42) # seed = reproducible jitter
plot(runif(n, 0.75, 1.25), x, xlim = c(0.4, 1.6), xaxt = "n", xlab = "",
ylab = sprintf("%s (%s)", label, units), pch = 21, cex = 1.4, las = 1,
bg = adjustcolor("#16a34a", alpha.f = 0.6), col = "white",
main = "Data, mean and 95% CI", cex.main = 1)
arrows(1.45, ci[1], 1.45, ci[2], angle = 90, code = 3, length = 0.08,
lwd = 2.5, col = "#2563eb")
points(1.45, m, pch = 19, cex = 1.6, col = "#2563eb")
levels <- c(0.90, 0.95, 0.99)
cis <- t(sapply(levels, function(L) m + c(-1, 1) * qt(1 - (1 - L) / 2, df) * se))
plot(NA, xlim = range(cis), ylim = c(0.5, 3.6), yaxt = "n",
xlab = sprintf("%s (%s)", label, units), ylab = "",
main = "Wider confidence, wider interval", cex.main = 1)
axis(2, at = 1:3, labels = paste0(levels * 100, "%"), las = 1)
segments(cis[, 1], 1:3, cis[, 2], 1:3, lwd = 5,
col = c("#0d9488", "#2563eb", "#9333ea"))
points(rep(m, 3), 1:3, pch = 19, cex = 1.3)
abline(v = m, lty = 2, col = "grey50")
text(cis[, 2], 1:3 + 0.2, sprintf("%.2f to %.2f", cis[, 1], cis[, 2]),
adj = 1, cex = 0.75)
dev.off()
cat("Saved confidence_interval.png\n")
Run it with Rscript ci.R from a terminal, or paste it into the RStudio console. It prints the mean 52.4375, t* 2.1314, margin 2.2352 and the 95% interval 50.2023 to 54.6727, then the Wilson interval 0.2705 to 0.4388 for 42 of 120.
10.2 What each part does
| Line or function | What it does, and why it is there |
|---|---|
| x[!is.na(x)] | Drops missing values. mean() and sd() return NA if even one value is missing, so clean first and you also know the real n. |
| sd(x) | The sample SD with the n − 1 divisor, matching Excel STDEV.S. R has no population option. |
| qt(1 - (1 - conf)/2, df) | The two-sided t critical value. For 95% and df = 15 it is 2.1314. For a one-sided bound use qt(conf, df). |
| t.test(x, conf.level = conf) | Gives the same interval in one line. It also runs a test against μ = 0, which you can ignore here. |
| qchisq(...) | Chi-square quantiles for the SD interval. Note the upper quantile gives the lower limit, which is why the order looks reversed. |
| pbinom(ks - 1, n, 0.5) | Finds the order statistics for a distribution-free median interval. The exact coverage is printed because it is always a little above 95%. |
| shapiro.test(x) | Checks normality. With small n a low p-value means the t interval may be wrong. |
| prop.test(..., correct = FALSE) | Gives the Wilson score interval. The default correct = TRUE adds a continuity correction, so it will not match this page or Python. |
| binom.test(...) | Gives the exact Clopper-Pearson interval. |
| png(..., res = 300) | Opens a 300 dpi file. Without res the figure is a blurry 72 dpi image. |
| set.seed(42) | Fixes the random jitter so the figure is identical every run. |
| arrows(..., angle = 90, code = 3) | Draws the error bar with flat caps at both ends. |
| dev.off() | Closes the file. Forget it and you get an empty PNG. |
10.3 What the figure shows
The left panel shows every leaf as a dot, with the mean and its 95% confidence interval as a blue error bar on the right. Notice how much shorter the error bar is than the spread of the dots: the interval describes the mean, not the individual leaves. The right panel draws the 90%, 95% and 99% intervals on the same axis so you can see that asking for more confidence always buys a wider interval.
10.4 Common R problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
Interval is NA NA | A missing value in x | Run x <- x[!is.na(x)] first |
| Proportion interval differs from Python | prop.test uses a continuity correction by default | Add correct = FALSE |
| Two-group interval differs from SPSS or SciPy | t.test(a, b) is Welch by default | Add var.equal = TRUE for the pooled interval |
| Paired interval is far too wide | Paired data treated as two independent groups | Use t.test(a, b, paired = TRUE) |
| One-sided bound looks wrong | Used qt(0.975, df) | Use t.test(x, alternative = "greater")$conf.int |
shapiro.test error | n under 3 or over 5000 | Look at a Q-Q plot instead |
| PNG is empty | dev.off() not run | Run dev.off() until it says null device |
10.5 Useful one-liners
| You want | R code |
|---|---|
| 95% CI for a mean | t.test(x)$conf.int |
| 99% CI for a mean | t.test(x, conf.level = 0.99)$conf.int |
| CI for a mean difference (Welch) | t.test(a, b)$conf.int |
| Wilson CI for a proportion | prop.test(42, 120, correct = FALSE)$conf.int |
| Exact CI for a proportion | binom.test(42, 120)$conf.int |
| CI for two proportions | prop.test(c(56, 38), c(80, 75), correct = FALSE)$conf.int |
| Bootstrap CI for the median | quantile(replicate(9999, median(sample(x, replace = TRUE))), c(.025, .975)) |
| CI per group | tapply(df$value, df$group, function(v) t.test(v)$conf.int) |
| Sample size for ±3 with σ = 15 | ceiling((qnorm(0.975) * 15 / 3)^2) |
📈 11. How to Calculate a Confidence Interval in Python
In Python, scipy.stats.t.interval(0.95, df, loc, scale) gives the interval in one call, but only if you pass the standard error as scale, which is the most common mistake. The script below computes every part by hand, checks it, adds the SD, median and proportion intervals, prints a verdict and saves one 300 dpi figure.
x = np.array([...]) line, and succ and trials for the proportion.Install once with pip install numpy scipy matplotlib. SciPy 1.10 or newer is needed for binomtest(...).proportion_ci.
11.1 The complete script
Python 3, saves confidence_interval.png
# ============================================================
# Confidence interval calculator: mean, SD, median and proportion
# StatsUnlock - https://statsunlock.com/confidence-interval-calculator/
# Needs numpy, scipy and matplotlib.
# ============================================================
import numpy as np
from scipy import stats
import matplotlib
matplotlib.use("Agg") # draw to file, no window needed
import matplotlib.pyplot as plt
# ---- 1. Your data ------------------------------------------
# Replace with your own values, or read a CSV:
# import pandas as pd
# x = pd.read_csv("data.csv")["leaf_length"].dropna().to_numpy()
x = np.array([52, 48, 55, 61, 47, 50, 58, 53,
49, 56, 51, 54, 46, 57, 50, 52], dtype=float)
x = x[~np.isnan(x)] # drop missing values
conf = 0.95
label, units = "Leaf length", "mm"
# ---- 2. t interval for the mean ----------------------------
n = x.size
df = n - 1
m = x.mean()
s = x.std(ddof=1) # ddof=1 matches Excel STDEV.S and R sd()
se = s / np.sqrt(n)
tcrit = stats.t.ppf(1 - (1 - conf) / 2, df)
me = tcrit * se
lo, hi = m - me, m + me
lo2, hi2 = stats.t.interval(conf, df, loc=m, scale=se) # same answer, one line
# ---- 3. SD interval (chi-square) and median interval -------
chi_hi, chi_lo = stats.chi2.ppf([1 - (1 - conf) / 2, (1 - conf) / 2], df)
sd_lo, sd_hi = np.sqrt(df * s**2 / chi_hi), np.sqrt(df * s**2 / chi_lo)
xs = np.sort(x)
ks = np.arange(1, n // 2 + 1)
ok = ks[stats.binom.cdf(ks - 1, n, 0.5) <= (1 - conf) / 2]
if ok.size:
k = ok.max()
med_lo, med_hi = xs[k - 1], xs[n - k]
cover = 1 - 2 * stats.binom.cdf(k - 1, n, 0.5)
sw = stats.shapiro(x)
# ---- 4. Proportion interval (Wilson and exact) -------------
succ, trials = 42, 120
bt = stats.binomtest(succ, trials)
wil = bt.proportion_ci(confidence_level=conf, method="wilson")
cp = bt.proportion_ci(confidence_level=conf, method="exact")
# ---- 5. Print the results ----------------------------------
rel = me / abs(m) * 100
print(f"n = {n}, df = {df}")
print(f"mean = {m:.4f}, SD = {s:.4f}, SE = {se:.4f}")
print(f"t* = {tcrit:.4f}, margin of error = {me:.4f}")
print(f"{conf:.0%} CI for the mean: {lo:.4f} to {hi:.4f}")
print(f"{conf:.0%} CI for the SD: {sd_lo:.4f} to {sd_hi:.4f}")
if ok.size:
print(f"CI for the median: {med_lo:g} to {med_hi:g} (exact coverage {cover:.1%})")
print(f"Shapiro-Wilk W = {sw.statistic:.4f}, p = {sw.pvalue:.4f}")
print(f"Proportion {succ}/{trials} = {succ/trials:.4f}")
print(f" Wilson {wil.low:.4f} to {wil.high:.4f}; exact {cp.low:.4f} to {cp.high:.4f}")
verdict = "high" if rel < 5 else "moderate" if rel < 10 else "low"
print(f"Verdict: the margin of error is {rel:.1f}% of the mean, so precision is {verdict}.")
if n < 30 and sw.pvalue < 0.05:
print("Warning: small sample and non-normal data, prefer the median interval.")
# ---- 6. One figure, two panels -----------------------------
rng = np.random.default_rng(42) # seeded so the jitter is reproducible
fig, (a1, a2) = plt.subplots(1, 2, figsize=(10, 5))
a1.scatter(rng.uniform(0.75, 1.25, n), x, s=60, color="#16a34a",
alpha=0.6, edgecolor="white")
a1.errorbar(1.45, m, yerr=me, fmt="o", color="#2563eb", capsize=8,
lw=2.5, ms=9, label=f"Mean and {conf:.0%} CI")
a1.set_xlim(0.4, 1.6)
a1.set_xticks([])
a1.set_ylabel(f"{label} ({units})")
a1.set_title("Data, mean and 95% CI", fontweight="bold")
a1.legend(frameon=False, loc="upper left")
levels = [0.90, 0.95, 0.99]
cols = ["#0d9488", "#2563eb", "#9333ea"]
for i, (L, c) in enumerate(zip(levels, cols), start=1):
h = stats.t.ppf(1 - (1 - L) / 2, df) * se
a2.hlines(i, m - h, m + h, color=c, lw=5)
a2.plot(m, i, "o", color="black")
a2.text(m + h, i + 0.15, f"{m - h:.2f} to {m + h:.2f}", ha="right", fontsize=9)
a2.axvline(m, ls="--", color="grey")
a2.set_yticks([1, 2, 3], [f"{L:.0%}" for L in levels])
a2.set_ylim(0.5, 3.6)
a2.set_xlabel(f"{label} ({units})")
a2.set_title("Wider confidence, wider interval", fontweight="bold")
fig.tight_layout()
fig.savefig("confidence_interval.png", dpi=300, bbox_inches="tight")
print("Saved confidence_interval.png")
11.2 What each part does
| Line or function | What it does, and why it is there |
|---|---|
| x[~np.isnan(x)] | Removes missing values. np.mean returns nan if any value is nan. |
| x.std(ddof=1) | The sample SD. Without ddof=1 NumPy divides by n, so the interval comes out too narrow and disagrees with Excel and R. |
| stats.t.ppf(1 - (1-conf)/2, df) | The two-sided critical t value, 2.1314 here. |
| stats.t.interval(conf, df, loc=m, scale=se) | The one-line interval. scale must be the standard error, not the SD. |
| stats.chi2.ppf(...) | Chi-square quantiles for the SD interval. |
| stats.binom.cdf(ks - 1, n, 0.5) | Finds the order statistics for the median interval. |
| stats.shapiro(x) | Shapiro-Wilk normality check. SciPy works in single precision here, so the fifth decimal can differ from R. |
| binomtest(...).proportion_ci(method="wilson") | Wilson score interval. method="exact" gives Clopper-Pearson. |
| np.random.default_rng(42) | Seeded random jitter so the figure is reproducible. |
| fig.savefig(..., dpi=300) | Saves a print-quality image. bbox_inches="tight" trims white space. |
11.3 What the figure shows
Exactly the same two panels as the R figure: the raw data with the mean and its 95% interval, and the 90%, 95% and 99% intervals stacked so you can see the trade-off between confidence and width. The labels give the limits, 50.20 to 54.67 for 95%.
11.4 Common Python problems and fixes
| Symptom | Cause | Fix |
|---|---|---|
| Interval is far too wide | Passed the SD as scale in t.interval | Pass s / np.sqrt(n) |
| Interval slightly too narrow | np.std without ddof=1 | Add ddof=1 |
t.interval TypeError about alpha | Old SciPy used alpha=, new uses confidence= as the first argument | Pass the level positionally: t.interval(0.95, df, ...) |
proportion_ci not found | SciPy older than 1.10 | Upgrade SciPy, or use statsmodels proportion_confint(method="wilson") |
| statsmodels gives a different proportion interval | proportion_confint defaults to Wald | Add method="wilson" |
| Two-group interval differs from R | SciPy ttest_ind defaults to pooled | Use equal_var=False for Welch |
| No figure window in Jupyter | The script uses the Agg backend | Delete the matplotlib.use("Agg") line and add plt.show() |
11.5 Useful one-liners
| You want | Python code |
|---|---|
| 95% CI for a mean | stats.t.interval(0.95, len(x)-1, x.mean(), stats.sem(x)) |
| CI for a mean difference (Welch) | stats.ttest_ind(a, b, equal_var=False).confidence_interval(0.95) |
| Wilson CI for a proportion | stats.binomtest(42, 120).proportion_ci(method="wilson") |
| Exact CI for a proportion | stats.binomtest(42, 120).proportion_ci(method="exact") |
| Bootstrap CI for the median | stats.bootstrap((x,), np.median, confidence_level=0.95).confidence_interval |
| CI per group with pandas | df.groupby("g")["v"].agg(lambda v: stats.t.interval(0.95, len(v)-1, v.mean(), stats.sem(v))) |
| Sample size for ±5% at 95% | int(np.ceil(stats.norm.ppf(0.975)**2 * 0.25 / 0.05**2)) |
Run it with python ci.py from a terminal. In Jupyter, drop the matplotlib.use("Agg") line and end with plt.show().
📋 12. Reference Tables
12.1 z critical values for common confidence levels
| Confidence level | α | Two-sided z | One-sided z |
|---|---|---|---|
| 80% | 0.200 | 1.2816 | 0.8416 |
| 85% | 0.150 | 1.4395 | 1.0364 |
| 90% | 0.100 | 1.6449 | 1.2816 |
| 95% | 0.050 | 1.9600 | 1.6449 |
| 98% | 0.020 | 2.3263 | 2.0537 |
| 99% | 0.010 | 2.5758 | 2.3263 |
| 99.5% | 0.005 | 2.8070 | 2.5758 |
| 99.9% | 0.001 | 3.2905 | 3.0902 |
What to conclude: 1.645, 1.960 and 2.576 are the numbers to remember for 90%, 95% and 99%. Use them only when σ is known or n is large; otherwise use t from 12.2. Values from the standard normal quantile function (Neyman, 1937).
12.2 t critical values (two-sided) by degrees of freedom
| df = n − 1 | 90% | 95% | 99% |
|---|---|---|---|
| 1 | 6.314 | 12.706 | 63.657 |
| 2 | 2.920 | 4.303 | 9.925 |
| 3 | 2.353 | 3.182 | 5.841 |
| 4 | 2.132 | 2.776 | 4.604 |
| 5 | 2.015 | 2.571 | 4.032 |
| 6 | 1.943 | 2.447 | 3.707 |
| 7 | 1.895 | 2.365 | 3.499 |
| 8 | 1.860 | 2.306 | 3.355 |
| 9 | 1.833 | 2.262 | 3.250 |
| 10 | 1.812 | 2.228 | 3.169 |
| 12 | 1.782 | 2.179 | 3.055 |
| 15 | 1.753 | 2.131 | 2.947 |
| 20 | 1.725 | 2.086 | 2.845 |
| 25 | 1.708 | 2.060 | 2.787 |
| 30 | 1.697 | 2.042 | 2.750 |
| 40 | 1.684 | 2.021 | 2.704 |
| 60 | 1.671 | 2.000 | 2.660 |
| 120 | 1.658 | 1.980 | 2.617 |
| ∞ (z) | 1.645 | 1.960 | 2.576 |
What to conclude: with df = 15 the 95% value is 2.131, about 9% bigger than z = 1.960. The gap matters below about 30 df and almost vanishes after 120 (Student, 1908).
12.3 Margin of error for a proportion near 50%
| Sample size n | 90% | 95% | 99% |
|---|---|---|---|
| 30 | ±15.0% | ±17.9% | ±23.5% |
| 50 | ±11.6% | ±13.9% | ±18.2% |
| 100 | ±8.2% | ±9.8% | ±12.9% |
| 200 | ±5.8% | ±6.9% | ±9.1% |
| 400 | ±4.1% | ±4.9% | ±6.4% |
| 600 | ±3.4% | ±4.0% | ±5.3% |
| 1000 | ±2.6% | ±3.1% | ±4.1% |
| 1500 | ±2.1% | ±2.5% | ±3.3% |
| 2000 | ±1.8% | ±2.2% | ±2.9% |
| 5000 | ±1.2% | ±1.4% | ±1.8% |
What to conclude: a poll of 1,000 people has a 95% margin of about ±3.1 points. Going from 1,000 to 2,000 only shrinks it to ±2.2. Values use z√(0.25/n), the worst case p = 0.5.
12.4 Sample size for a proportion (p = 0.5)
| Target margin E | 90% | 95% | 99% |
|---|---|---|---|
| ±10% | 68 | 97 | 166 |
| ±5% | 271 | 385 | 664 |
| ±4% | 423 | 601 | 1,037 |
| ±3% | 752 | 1,068 | 1,844 |
| ±2% | 1,691 | 2,401 | 4,147 |
| ±1% | 6,764 | 9,604 | 16,588 |
What to conclude: 385 respondents give ±5 points at 95%, and 1,068 give ±3 points. Halving the margin quadruples n (Lenth, 2001).
12.5 Which interval method to use
| Estimate | Recommended | Acceptable | Avoid |
|---|---|---|---|
| Mean, σ unknown | t interval | Bootstrap for skewed data | z with a sample SD when n < 30 |
| Mean, skewed small sample | Median (order statistic) interval | Log-transform then t | Plain t interval |
| One proportion | Wilson or Jeffreys | Clopper-Pearson, Agresti-Coull | Wald when np or nq < 10 |
| Difference of two means | Welch | Pooled if SDs are similar | Comparing two separate intervals by overlap |
| Difference of two proportions | Newcombe hybrid score | Agresti-Caffo | Wald with small counts |
| Standard deviation | Chi-square interval (normal data) | Bootstrap | Chi-square with heavy tails |
What to conclude: the method matters most for proportions with small counts and for skewed small samples (Brown, Cai and DasGupta, 2001; Newcombe, 1998).
12.6 Wald, Wilson and exact intervals side by side (95%)
| x / n | p̂ | Wald | Wilson | Clopper-Pearson |
|---|---|---|---|---|
| 0 / 20 | 0.000 | 0.000 to 0.000 | 0.000 to 0.161 | 0.000 to 0.168 |
| 1 / 20 | 0.050 | 0.000 to 0.146 | 0.009 to 0.236 | 0.001 to 0.249 |
| 3 / 40 | 0.075 | 0.000 to 0.157 | 0.026 to 0.199 | 0.016 to 0.204 |
| 10 / 50 | 0.200 | 0.089 to 0.311 | 0.112 to 0.330 | 0.100 to 0.337 |
| 42 / 120 | 0.350 | 0.265 to 0.435 | 0.271 to 0.439 | 0.265 to 0.442 |
| 95 / 100 | 0.950 | 0.907 to 0.993 | 0.888 to 0.978 | 0.887 to 0.984 |
What to conclude: with 0 of 20 the Wald interval collapses to 0 to 0, while Wilson and the exact method give an honest upper limit near 0.16. With large counts, as in 42 of 120, all three agree to about one percentage point.
📈 13. Example Results
Leaf length in a botany practical
The clean t interval everyone learns first.
Sixteen leaves measured to the nearest millimetre. The class wants the 95% confidence interval for the mean leaf length of the species.
| Statistic | Value | Note |
|---|---|---|
| n | 16 | Count |
| Mean | 52.4375 | Sum 839 ÷ 16 |
| SD | 4.1947 | n − 1 divisor |
| SE | 1.0487 | s ÷ √n |
| t*, df 15 | 2.1314 | T.INV.2T(0.05,15) |
| Margin of error | 2.2352 | t* × SE |
| 95% CI | 50.2023 to 54.6727 | Mean ± margin |
What it means: We are 95% confident the species mean leaf length is between 50.20 and 54.67 mm. The margin is 4.3% of the mean, so the estimate is precise even from 16 leaves because the leaves vary little.
How to write it: "Mean leaf length was 52.44 mm (SD = 4.19, n = 16), 95% CI [50.20, 54.67]."
Customer wait time, from summary numbers
A big sample gives a tight interval.
A bank reports a mean wait of 7.4 minutes (SD 2.1) from 200 customers, but not the raw data.
| Statistic | Value | Note |
|---|---|---|
| n | 200 | Customers |
| Mean | 7.4000 | Minutes |
| SE | 0.1485 | 2.1 ÷ √200 |
| t*, df 199 | 1.9720 | Almost z = 1.960 |
| Margin of error | 0.2928 | About 18 seconds |
| 95% CI | 7.1072 to 7.6928 | High precision |
What it means: The mean wait is known to within about ±0.29 minutes. With n = 200 the t and z values are almost the same, so either gives the same answer to two decimals.
How to write it: "Mean waiting time was 7.40 minutes (SD = 2.10, n = 200), 95% CI [7.11, 7.69]."
Survey: 42 of 120 said yes
The proportion confidence interval, five ways.
A survey asks 120 randomly chosen residents whether they support a new bus route. 42 say yes.
| Statistic | Value | Note |
|---|---|---|
| p̂ | 0.3500 | 42 ÷ 120 |
| Wilson | 0.2705 to 0.4388 | Recommended |
| Clopper-Pearson | 0.2652 to 0.4424 | Exact, widest |
| Jeffreys | 0.2690 to 0.4381 | Close to nominal |
| Agresti-Coull | 0.2704 to 0.4389 | Simple |
| Wald | 0.2647 to 0.4353 | Fine here, np = 42 |
What it means: Support is most likely between about 27% and 44%. The interval excludes 50%, so a majority in favour is ruled out at 95% confidence. With large counts the method choice hardly matters.
How to write it: "Of 120 residents, 42 (35.0%) supported the route, 95% CI [27.1%, 43.9%] (Wilson)."
VO2 max in six athletes
Why t and not z for small samples.
Only six athletes could be tested. The coach wants a 95% interval for squad mean VO2 max.
| Statistic | Value | Note |
|---|---|---|
| Mean | 49.9833 | ml/kg/min |
| SD | 3.3985 | |
| SE | 1.3874 | s ÷ √6 |
| t*, df 5 | 2.5706 | 31% larger than z |
| 95% CI (t, correct) | 46.4168 to 53.5498 | Use this |
| 95% CI (z, wrong) | 47.2640 to 52.7026 | Too narrow |
What it means: With only 5 degrees of freedom t* = 2.571, so the t interval is 31% wider than the z interval. The wider one is the honest one. Shapiro-Wilk p = 0.82 gives no sign of non-normality.
How to write it: "Mean VO2 max was 49.98 ml/kg/min (SD = 3.40, n = 6), 95% CI [46.42, 53.55]."
Student's sleep data: Drug 2 minus Drug 1
An interval that includes zero.
The classic 1908 data: extra hours of sleep under two drugs, 10 patients each, treated here as independent groups.
| Statistic | Value | Note |
|---|---|---|
| Mean Drug 1 | 0.7500 | hours |
| Mean Drug 2 | 2.3300 | hours |
| Difference | 1.5800 | Drug 2 minus Drug 1 |
| Welch df | 17.78 | |
| 95% CI | -0.2055 to 3.3655 | Includes 0 |
| Welch p | 0.0794 | Matches: above 0.05 |
What it means: The best estimate is that Drug 2 adds 1.58 hours more sleep, but the interval runs from a small loss of 0.21 hours to a gain of 3.37 hours. That is not evidence of no effect; it is evidence of too little data. (In the original paired design the interval does exclude 0.)
How to write it: "Drug 2 increased sleep by 1.58 h relative to Drug 1, 95% CI [−0.21, 3.37] (Welch, independent groups)."
Blood pressure in 10,000 adults
When the interval excludes 0 but the effect is tiny.
Two diets, 5,000 adults each, SD 10 mmHg in both groups. Mean systolic pressure differs by 0.6 mmHg.
| Statistic | Value | Note |
|---|---|---|
| Difference | 0.6000 | mmHg |
| SE | 0.2000 | √(10²/5000 × 2) |
| 95% CI | 0.2080 to 0.9920 | Excludes 0 |
| Cohen d | 0.06 | Negligible |
| Clinically important | 5 mmHg | Far above the upper limit |
What it means: With 10,000 people almost any difference is "significant". The interval shows the real story: the true difference is at most about 1 mmHg, which no doctor would act on. This is why journals ask for intervals, not just p-values.
How to write it: "Diet A was associated with 0.6 mmHg higher systolic pressure, 95% CI [0.2, 1.0], a difference too small to be clinically relevant."
Hospital length of stay
Skewed data break the t interval.
Twenty patients. Most stay 2 to 6 days, but two stay 21 and 35 days.
| Statistic | Value | Note |
|---|---|---|
| Mean | 5.8000 | Pulled up by 2 long stays |
| SD | 8.0039 | Larger than the mean |
| t interval | 2.0540 to 9.5460 | Unreliable |
| Median | 3 | Typical stay |
| Median interval | 3 to 4 | Exact coverage 95.9% |
| Shapiro-Wilk | W = 0.483, p < 0.001 | Strongly non-normal |
What it means: The t interval claims the mean stay is 2.1 to 9.5 days, but with n = 20 and two extreme values its coverage is doubtful. The distribution-free median interval, 3 to 4 days, needs no normality and describes the typical patient far better.
How to write it: "Median length of stay was 3 days, 95% CI [3, 4] (distribution-free); the mean (5.8 days) is reported for completeness."
Zero adverse events in 25 patients
The Wald formula breaks completely.
A small safety study sees no adverse events in 25 patients. Can we say the risk is zero?
| Statistic | Value | Note |
|---|---|---|
| p̂ | 0.0000 | 0 ÷ 25 |
| Wald | 0.0000 to 0.0000 | Impossible, zero width |
| Wilson | 0.0000 to 0.1332 | Sensible |
| Clopper-Pearson | 0.0000 to 0.1372 | Exact |
| Rule of three | 3 ÷ 25 = 0.12 | Quick one-sided 95% bound |
What it means: The Wald formula says the risk is exactly zero, which is plainly false. The exact Clopper-Pearson interval shows the true risk could be up to 13.7%, and Wilson gives 13.3%. Hanley and Lippman-Hand (1983) give the shortcut: with 0 events in n, the 95% upper bound is about 3 ÷ n.
How to write it: "No adverse events occurred in 25 patients (0%, 95% CI 0% to 13.7%, Clopper-Pearson)."
🧪 14. Data Collection Protocol
Study design: a confidence interval assumes a random (or at least representative) sample of independent units from one clearly defined population, measured the same way each time. For a mean the outcome is numeric on an interval or ratio scale. For a proportion each unit is a yes or no outcome.
- Decide what you will put a confidence interval around before collecting. A mean, a proportion, a difference between groups, or a standard deviation. Each needs a different data layout and a different formula.
- Define the population and the unit. One leaf, one patient, one household. Repeat readings on the same unit are not independent and make the interval falsely narrow.
- Plan the sample size for your target margin of error. Use the sample size option in Section 2 with a pilot SD or an expected proportion. To estimate a proportion to ±5 points at 95% you need 385 units; to ±3 points, 1,068.
- Choose the confidence level in advance. 95% unless your field or regulator says otherwise. Write it down.
- Randomise selection. A confidence interval only covers random sampling error. It cannot correct for a convenience sample or for non-response.
- Fix the measuring instrument, units and resolution. Changing scales or observers part-way adds hidden variation that widens the interval.
- Record yes or no outcomes as counts. For a proportion keep the number of successes x and the number of trials n, not just the percentage, because the interval depends on n.
- Record missing data as blanks, never zeros. A zero is a real value and shifts the mean and the SD.
- Note the group of every unit if you plan to compare groups, so that each group becomes its own column (cluster).
- Write the outlier rule before you see the data. Dropping awkward values afterwards to narrow a confidence interval is a form of bias.
| Placebo (mmHg) | Treatment (mmHg) | Control (mmHg) |
|---|---|---|
| 148 | 139 | 151 |
| 152 | 141 | 147 |
| 145 | 136 | 149 |
One column per group, one row per unit, numbers only below the header row. Blank cells are ignored, so groups can be different sizes. Upload this layout and click each column to load it as a cluster.
Minimum sample: a t interval can be computed with n = 2, but it is very wide (t* = 12.71 at 95%). Aim for at least 10 per group for a usable interval and 30 or more if the data may be skewed. For a proportion the Wilson interval works at any n, but aim for at least 10 successes and 10 failures if you plan to report the Wald formula.
Pre-registration: state the estimate, the interval method (t, Wilson, Newcombe), the confidence level, the target margin of error and the planned n before data collection.
Common collection mistakes:
- Counting repeat measurements of one subject as separate units.
- Keeping only the percentage and losing the sample size.
- Pooling two different populations into one column.
- Stopping data collection as soon as the interval excludes zero.
- Recording "not measured" as 0.
🎯 15. When to Use This Calculator
This free confidence interval calculator is designed for students, researchers, analysts and survey teams who need to state how precisely a sample estimates a population value.
Use it when:
- ✓ You want a range for a population mean, from raw data or from a reported mean, SD and n.
- ✓ You want a range for a percentage or proportion, including rare events with 0 successes.
- ✓ You want the interval for the difference between two group means or two proportions.
- ✓ You need the margin of error for a survey or the sample size to reach a target margin.
- ✓ A journal asks for effect sizes with 95% confidence intervals instead of p-values alone.
Use something else when:
- ✗ The two groups are paired (before and after on the same people). Use a paired interval on the differences: paste the differences as one cluster.
- ✗ You want a range for one future observation. Use a prediction interval.
- ✗ You need intervals for regression slopes, odds ratios or hazard ratios. Use the matching model tool.
- ✗ The data come from a stratified or clustered survey design. Use design-based standard errors.
- ✗ You have prior information you want to include. Use a Bayesian credible interval.
Real-world examples:
- Clinical trial: 95% CI for the mean drop in blood pressure under a new drug.
- Opinion poll: the margin of error around 52% support from 1,000 voters.
- Ecology: 95% CI for mean seedling height on three restoration plots.
- Quality control: a one-sided 95% upper bound for the defect rate when 0 of 300 items failed.
Decision tree:
| Your situation | Interval to use |
|---|---|
| One group, numeric, σ unknown | t interval for the mean (default here) |
| One group, numeric, σ truly known | z interval (fill the σ box) |
| One group, numeric, small and skewed | Median interval or bootstrap |
| Yes or no outcome, one group | Wilson score, or Clopper-Pearson for guaranteed coverage |
| Two independent groups, numeric | Welch interval for the difference |
| Two paired measurements | t interval on the differences |
| Two independent proportions | Newcombe hybrid score interval |
| Spread of one group | Chi-square interval for the SD |
| Planning a study | Sample size option |
🔧 16. Troubleshooting and Common Errors
The interval is extremely wide
Cause: very small n, a large SD, or a high confidence level. With n = 3 the 95% t value is 4.30. Fix: collect more data, use the sample size option to see how many you need, or report the interval honestly as imprecise.
My answer is narrower than this calculator
Cause: you used z = 1.96 instead of t, or the population SD (STDEV.P, np.std without ddof). Fix: use t with n − 1 df and the sample SD.
The proportion interval goes below 0 or above 1
Cause: the Wald formula. Fix: use Wilson, Jeffreys or Clopper-Pearson, which always stay inside 0 to 1. This tool clips Wald at 0 and 1 and flags it.
With 0 successes the Wald interval is 0 to 0
Cause: p̂ = 0 makes the Wald SE zero. Fix: use Clopper-Pearson or Wilson. For 0 of n the exact 95% upper limit is close to 3 ÷ n.
Shapiro-Wilk says non-normal
Cause: skew or outliers. Fix: with n ≥ 30 the t interval is usually still fine. With small n, report the median interval, log-transform positive skewed data, or bootstrap.
Group intervals overlap but the test was significant
Cause: overlap is not a test. Fix: read the interval for the difference, which this tool gives for every cluster against cluster 1.
Excel CONFIDENCE.T gave one number, not two
Cause: it returns the margin of error. Fix: lower = mean − margin, upper = mean + margin.
R prop.test differs from this page
Cause: R adds a continuity correction by default. Fix: prop.test(x, n, correct = FALSE) reproduces the Wilson row.
The difference interval changes when I switch Welch and pooled
Cause: the groups have different SDs or sizes. Fix: keep Welch unless you have a strong reason to assume equal variances. The variance ratio is shown in the checks table.
The median interval says "not available"
Cause: with n under 6, no pair of order statistics reaches 95% coverage. Fix: lower the confidence level or collect more data.
A value is rejected as not a number
Cause: units, currency symbols or comma decimal separators such as 4,5. Fix: use a full stop for decimals and keep units in the group name.
The charts do not appear
Cause: the Chart.js CDN was blocked, or Calculate has not been pressed. Fix: allow cdnjs.cloudflare.com and press Calculate. The tables still work without charts.
⚖ 17. Assumptions and Limitations
Assumptions
- Random sampling. Check how units were chosen. If the sample is biased, the interval is centred on the wrong value and its coverage can be near zero; it does not widen to warn you.
- Independence. Check the design for repeats, clusters or time series. Positive dependence makes the true SE larger, so the interval is too narrow and coverage falls below the nominal level.
- Approximate normality of the mean (t and z intervals). Check Shapiro-Wilk and Chart 2 when n < 30. Strong right skew makes the interval too short on the long-tail side, so coverage drops, worst for one-sided bounds.
- Normality of the data (SD interval). The chi-square interval for σ needs normal data at any n. Heavy tails make it too narrow, sometimes badly.
- Fixed n and a binary outcome (proportions). Each unit must be a success or failure with the same chance. Overdispersion (clustered yes or no outcomes) makes every binomial interval too narrow.
- Success-failure condition (Wald only). Check np̂ ≥ 10 and n(1 − p̂) ≥ 10. When it fails, Wald coverage falls below 95%, sometimes far below.
- Known σ (z interval only). If the σ you enter is a guess and too small, the interval is too narrow.
Limitations
- The interval reflects random sampling error only, not measurement bias, selection bias or confounding. Use sensitivity analysis or a better design for those.
- It is about the mean or proportion, not individuals. For a range of individual values use a prediction or tolerance interval.
- Overlap of group intervals is not a test. Use the difference interval or the two-sample t-test.
- The tool treats data as a simple random sample. For weighted, stratified or cluster samples use survey software (R
survey, Statasvy). - The median interval is conservative: its exact coverage is at or above the requested level because order statistics jump in steps. A bootstrap BCa interval is an alternative.
- Multiple intervals at 95% each do not all hold together with 95% confidence. For many comparisons use a Bonferroni or Tukey adjustment.
- Sample size results depend entirely on the guessed σ or p. A guess that is too small gives a study that is too small.
🏁 18. Conclusion
18.1 What was found
A confidence interval calculator turns a single sample estimate into a range that honestly shows how much that estimate could move if you sampled again. For the worked leaf data, a mean of 52.44 mm became 50.20 to 54.67 mm at 95% confidence, a margin of error of 2.24 mm, or about 4% of the mean. That is a precise estimate from only 16 leaves because the leaves vary little.
18.2 What it means in practice
The interval is the result to report, not an extra. It tells the reader the effect size and the precision in the units they care about, and it makes the link to significance testing obvious: if the interval for a difference excludes zero, the difference is significant at the matching level. For proportions, the choice of method matters more than most people expect. Wilson and Jeffreys intervals keep close to their promised coverage, while the textbook Wald interval can fail badly with small samples or rare events.
18.3 Cautions
A confidence interval only covers random sampling error. It assumes independent units from the population you care about, and for small samples it assumes roughly normal data. It is not the range of individual values, and the 95% belongs to the method, not to one particular interval. Overlapping group intervals do not prove "no difference".
18.4 Next steps
Report the estimate, the confidence level and both limits together, name the method, and label error bars as confidence intervals. If the interval is too wide to support a decision, use the sample size option to plan the next study around a target margin of error. Then come back to this confidence interval calculator whenever you need a mean, proportion, difference or sample size interval checked against Excel, R and Python.
❓ 19. Frequently Asked Questions
Q1. What is a confidence interval calculator?
A confidence interval calculator turns a sample into a range of plausible values for the population mean, proportion or difference. It works out the standard error, multiplies it by a critical value from the t, z or binomial distribution and adds and subtracts that margin from the estimate.
Q2. How do you calculate a 95% confidence interval?
Find the mean and the standard deviation, divide the SD by the square root of n to get the standard error, multiply it by t for 95% with n minus 1 degrees of freedom (1.96 for large samples), then subtract and add that margin. For 16 leaves with mean 52.44 and SD 4.19 that gives 50.20 to 54.67.
Q3. What is the formula for a confidence interval?
For a mean it is x-bar plus or minus t times s divided by the square root of n. For a proportion the simple form is p-hat plus or minus z times the square root of p-hat(1 minus p-hat)/n, though the Wilson formula is more accurate for small samples.
Q4. What does a 95% confidence interval mean?
If you repeated the study many times and built an interval each time, about 95% of those intervals would contain the true population value. It does not mean there is a 95% probability that this particular interval contains it.
Q5. How do I calculate a confidence interval in Excel?
Use =CONFIDENCE.T(0.05,STDEV.S(A2:A17),COUNT(A2:A17)) to get the margin of error, then subtract it from and add it to =AVERAGE(A2:A17). CONFIDENCE.T returns only the margin, not the interval. Section 9 shows every step with spreadsheet screenshots.
Q6. How do I calculate a confidence interval in R?
For a mean use t.test(x)$conf.int. For a proportion use prop.test(x, n, correct = FALSE)$conf.int for the Wilson interval or binom.test(x, n)$conf.int for the exact interval. Section 10 has a complete script.
Q7. How do I calculate a confidence interval in Python?
Use scipy.stats.t.interval(0.95, n - 1, loc=mean, scale=sd/sqrt(n)) for a mean, and scipy.stats.binomtest(x, n).proportion_ci(method='wilson') for a proportion. Pass the standard error, not the SD, as scale. Section 11 has a full script.
Q8. How do I find a confidence interval on a TI-84?
Press STAT, go to TESTS, and choose TInterval for a mean with unknown sigma, ZInterval for known sigma, 1-PropZInt for one proportion or 2-PropZInt for two. Choose Data or Stats, set C-Level to .95 and press Calculate. Note that 1-PropZInt uses the Wald formula.
Q9. What is the z value for a 90%, 95% and 99% confidence interval?
The two-sided z values are 1.645 for 90%, 1.960 for 95% and 2.576 for 99%. For small samples with an unknown standard deviation use the larger t value instead, for example 2.131 for 95% with 15 degrees of freedom.
Q10. When should I use t instead of z?
Use t whenever the population standard deviation is unknown and you use the sample SD, which is almost always. Use z only when sigma is truly known, or for proportions. With large n the two give nearly the same answer.
Q11. How do I calculate the margin of error from a confidence interval?
Subtract the lower limit from the upper limit and divide by 2. For an interval of 50.20 to 54.67 the margin of error is 2.235, and the estimate in the middle is 52.44.
Q12. How do I calculate a confidence interval for a proportion?
Divide successes by the sample size to get p-hat, then use the Wilson score formula, or p-hat plus or minus 1.96 times the square root of p-hat(1 minus p-hat)/n when there are at least 10 successes and 10 failures. For 42 of 120 the Wilson 95% interval is 0.271 to 0.439.
Q13. What is a binomial (Clopper-Pearson) confidence interval?
It is the exact interval for a proportion built from the binomial distribution using beta quantiles. It guarantees at least the stated coverage, so it is a little wider than Wilson. For 0 events in 25 it gives 0 to 0.137.
Q14. How does sample size affect a confidence interval?
The width shrinks with the square root of n. Doubling the sample cuts the width by about 29%, and you need four times as many observations to halve it.
Q15. How do I calculate the sample size for a confidence interval?
For a mean use n = (z times sigma / E) squared, and for a proportion n = z squared times p(1 minus p) / E squared, then round up. For plus or minus 5 points at 95% with p = 0.5 you need 385.
Q16. Can I calculate a confidence interval without the standard deviation?
For a mean you need some measure of spread: either the raw data, the SD, or the standard error. For a proportion you only need the number of successes and the sample size, because the spread comes from p-hat itself.
Q17. How do I calculate a 95% confidence interval for a difference in means?
Subtract the two means, then add and subtract t times the square root of s1 squared/n1 plus s2 squared/n2, using Welch degrees of freedom. If the interval excludes 0 the difference is significant at the 5% level.
Q18. What does it mean if a confidence interval includes zero?
For a difference, an interval that includes 0 means the data are compatible with no difference at that confidence level, and the matching two-sided test gives p above alpha. It does not prove there is no difference.
Q19. Is a 99% confidence interval wider than a 95% one?
Yes. Asking for more confidence needs a larger critical value, so the interval is wider. For the leaf data the 95% interval is 50.20 to 54.67 and the 99% interval is 49.35 to 55.53.
Q20. Can I use this confidence interval calculator for my thesis?
Yes for teaching, checking hand calculations and exploratory work. For formal submission, reproduce the numbers in R, Python, SPSS or Stata with the scripts on this page and cite the software. You can also cite this tool as StatsUnlock (2026), Confidence interval calculator.
📑 20. Cite This Tool
StatsUnlock. (2026). Confidence interval calculator [Interactive statistical tool]. https://statsunlock.com/confidence-interval-calculator/@misc{statsunlock_ci_2026, title={Confidence Interval Calculator}, author={{StatsUnlock}}, year={2026}, note={Interactive statistical tool}, url={https://statsunlock.com/confidence-interval-calculator/}}Confidence intervals were computed with the StatsUnlock Confidence Interval Calculator (2026). Means are reported with two-sided 95% t intervals using n − 1 degrees of freedom, proportions with Wilson score intervals, and differences between groups with Welch intervals. Run the analysis above to replace this paragraph with your own values.🔗 21. Related Tools
Get the plus or minus figure for a survey or poll directly from n and the proportion.
Open the tool →Plan how many participants you need before the study starts.
Open the tool →The building block of every confidence interval for a mean.
Open the tool →Find t, z and chi-square critical values for any confidence level and df.
Open the tool →Test a mean against a target value, the test that matches the t interval.
Open the tool →Compare two group means with a test and the interval for the difference.
Open the tool →Test a percentage against a target such as 50%.
Open the tool →Compare two percentages, such as conversion rates in an A/B test.
Open the tool →📖 22. Glossary of Terms
| Term | Plain-English meaning |
|---|---|
| Agresti-Coull interval | A proportion interval that adds about two successes and two failures before using the simple formula. |
| Alpha (α) | One minus the confidence level. For a 95% interval, α = 0.05. |
| Clopper-Pearson interval | The "exact" binomial interval built from beta quantiles. It never covers less than promised, so it is a little wide. |
| Confidence interval | A range from the sample that is likely to contain the true population value. |
| Confidence level | How often the method captures the true value in repeated samples, such as 95%. |
| Coverage | The real share of intervals that contain the true value. Good methods have coverage close to the confidence level. |
| Critical value | The multiplier, such as t* = 2.131 or z = 1.960, that sets how many standard errors wide the interval is. |
| Degrees of freedom | The amount of information left to estimate spread, n − 1 for one sample. |
| Lower and upper limit | The two ends of the interval, also called confidence limits or bounds. |
| Margin of error | Half the width of a two-sided interval, the "plus or minus" number. |
| Newcombe interval | A method for the difference of two proportions built from the two Wilson intervals. |
| One-sided bound | A single limit, such as "at least 50.6", used when only one direction matters. |
| Point estimate | The single best guess from the sample, such as the sample mean or proportion. |
| Population | The whole group you want to learn about, usually too large to measure fully. |
| Prediction interval | A range for one new individual value. Much wider than a confidence interval for the mean. |
| Proportion | The share of units with a yes outcome, x divided by n, between 0 and 1. |
| Sample size | The number of independent units measured, n. |
| Standard deviation | How far typical values sit from the mean, in the data units. |
| Standard error | How much the estimate would vary from sample to sample. For a mean, s divided by √n. |
| t distribution | A bell-shaped curve with heavier tails than the normal, used when the SD is estimated from the sample. |
| Welch interval | The interval for a difference in means that does not assume equal variances. |
| Wilson score interval | A proportion interval that stays inside 0 to 1 and keeps close to its promised coverage. |
| z interval | An interval that uses the normal critical value, valid when σ is known or n is very large. |
📚 23. References
The following peer-reviewed references support the methods used in this confidence interval calculator: the t interval, binomial and score intervals for proportions, intervals for differences, normality checking, sample size planning and the correct interpretation of confidence intervals.
- Agresti, A., & Caffo, B. (2000). Simple and effective confidence intervals for proportions and differences of proportions result from adding two successes and two failures. The American Statistician, 54(4), 280–288. https://doi.org/10.1080/00031305.2000.10474560
- Agresti, A., & Coull, B. A. (1998). Approximate is better than "exact" for interval estimation of binomial proportions. The American Statistician, 52(2), 119–126. https://doi.org/10.1080/00031305.1998.10480550
- Brown, L. D., Cai, T. T., & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2), 101–133. https://doi.org/10.1214/ss/1009213286
- Clopper, C. J., & Pearson, E. S. (1934). The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika, 26(4), 404–413. https://doi.org/10.1093/biomet/26.4.404
- Cumming, G. (2014). The new statistics: Why and how. Psychological Science, 25(1), 7–29. https://doi.org/10.1177/0956797613504966
- Cumming, G., Fidler, F., & Vaux, D. L. (2007). Error bars in experimental biology. Journal of Cell Biology, 177(1), 7–11. https://doi.org/10.1083/jcb.200611141
- Gardner, M. J., & Altman, D. G. (1986). Confidence intervals rather than P values: Estimation rather than hypothesis testing. BMJ, 292(6522), 746–750. https://doi.org/10.1136/bmj.292.6522.746
- Greenland, S., Senn, S. J., Rothman, K. J., Carlin, J. B., Poole, C., Goodman, S. N., & Altman, D. G. (2016). Statistical tests, P values, confidence intervals, and power: A guide to misinterpretations. European Journal of Epidemiology, 31(4), 337–350. https://doi.org/10.1007/s10654-016-0149-3
- Hanley, J. A., & Lippman-Hand, A. (1983). If nothing goes wrong, is everything all right? Interpreting zero numerators. JAMA, 249(13), 1743–1745. https://doi.org/10.1001/jama.1983.03330370053031
- Hoekstra, R., Morey, R. D., Rouder, J. N., & Wagenmakers, E.-J. (2014). Robust misinterpretation of confidence intervals. Psychonomic Bulletin & Review, 21(5), 1157–1164. https://doi.org/10.3758/s13423-013-0572-3
- Lenth, R. V. (2001). Some practical guidelines for effective sample size determination. The American Statistician, 55(3), 187–193. https://doi.org/10.1198/000313001317098149
- Newcombe, R. G. (1998a). Two-sided confidence intervals for the single proportion: Comparison of seven methods. Statistics in Medicine, 17(8), 857–872. https://doi.org/10.1002/(SICI)1097-0258(19980430)17:8<857::AID-SIM777>3.0.CO;2-E
- Newcombe, R. G. (1998b). Interval estimation for the difference between independent proportions: Comparison of eleven methods. Statistics in Medicine, 17(8), 873–890. https://doi.org/10.1002/(SICI)1097-0258(19980430)17:8<873::AID-SIM779>3.0.CO;2-I
- Neyman, J. (1937). Outline of a theory of statistical estimation based on the classical theory of probability. Philosophical Transactions of the Royal Society of London, Series A, 236(767), 333–380. https://doi.org/10.1098/rsta.1937.0005
- Royston, P. (1995). Remark AS R94: A remark on algorithm AS 181: The W-test for normality. Journal of the Royal Statistical Society, Series C (Applied Statistics), 44(4), 547–551. https://doi.org/10.2307/2986146
- Schenker, N., & Gentleman, J. F. (2001). On judging the significance of differences by examining the overlap between confidence intervals. The American Statistician, 55(3), 182–186. https://doi.org/10.1198/000313001317097960
- Shapiro, S. S., & Wilk, M. B. (1965). An analysis of variance test for normality (complete samples). Biometrika, 52(3–4), 591–611. https://doi.org/10.1093/biomet/52.3-4.591
- Student. (1908). The probable error of a mean. Biometrika, 6(1), 1–25. https://doi.org/10.1093/biomet/6.1.1
- Welch, B. L. (1947). The generalization of "Student's" problem when several different population variances are involved. Biometrika, 34(1–2), 28–35. https://doi.org/10.1093/biomet/34.1-2.28
- Wilson, E. B. (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.10502953
