置信区间计算器
置信区间(CI)是从样本数据计算得出的数值范围,可能包含真实总体参数。输入样本均值、标准差和样本量——或您的比例数据——即时计算 90%、95% 或 99% 置信区间,含误差范围和标准误差。
CI = x̄ ± z × (σ / √n)
常见问题
什么是置信区间?
置信区间(CI)是一个可能以特定概率包含真实总体参数的数值范围。例如,95% 置信区间 [48, 52] 意味着如果多次重复研究,95% 的这类区间会包含真实总体均值。这并非说明真实值有 95% 的概率在此特定区间内。
如何计算均值的 95% 置信区间?
计算均值的 95% CI:(1) 计算标准误差:SE = σ / √n;(2) 乘以 z 分数:MOE = 1.960 × SE;(3) 加减样本均值:CI = [x̄ − MOE, x̄ + MOE]。例如,x̄ = 50,σ = 10,n = 100:SE = 1,MOE = 1.96,CI = [48.04, 51.96]。
90%、95% 和 99% 置信区间有什么区别?
置信水平越高,区间越宽。90% CI 使用 z* = 1.645,95% CI 使用 z* = 1.960,99% CI 使用 z* = 2.576。95% 水平是大多数研究的行业标准。在速度比确定性更重要时使用 90%,在高风险决策中假阳性代价很高时使用 99%。
什么是误差边距?
误差边距(MOE)是置信区间宽度的一半。它代表在给定置信水平下,样本估计值与真实总体值之间的最大预期差异。MOE = z* × SE = z* × (σ / √n)。对于民调,典型的 1,000 人调查在 95% 置信度下误差边距约为 ±3%。
样本量如何影响置信区间?
样本量越大,置信区间越窄(越精确)。标准误差为 σ/√n,因此 CI 宽度按 1/√n 的比例缩小。样本量翻倍,CI 宽度约减少 29%。要将误差边距减半,需要将样本量扩大四倍。
如何计算比例的置信区间?
对于比例(Wald 方法):(1) 计算 p̂ = 成功次数 / n;(2) 计算 SE = √(p̂(1 − p̂) / n);(3) 应用 MOE = z* × SE;(4) CI = [p̂ − MOE, p̂ + MOE],截断至 [0, 1]。例如,200 次中 60 次成功,p̂ = 30%,95% CI 约为 [23.65%, 36.35%]。
什么是标准误差,它与标准差有何不同?
标准差(σ)衡量单个数据点围绕均值的离散程度。标准误差(SE)衡量样本均值作为总体均值估计的精确度。SE = σ / √n。随着样本量增加,标准误差减小,即使标准差保持不变,因为更大的样本提供更精确的估计。
何时应使用置信区间而非假设检验?
置信区间和假设检验密切相关,通常传达相同的信息。当你想估计参数的合理范围时,使用置信区间。当你想要二元决策(拒绝/无法拒绝)时,使用假设检验。如果差异的 95% CI 不包含零,则对应的 α = 0.05 假设检验将拒绝零假设。CI 在研究中通常更受欢迎,因为它同时传达效应大小和不确定性。
What is a Confidence Interval?
A confidence interval (CI) is a range of values that likely contains the true population parameter with a specified probability. Instead of reporting a single point estimate (like a sample mean), a confidence interval acknowledges the inherent uncertainty in statistical estimation by providing a plausible range.
For example, a 95% confidence interval of [48, 52] means that if you repeated the study many times and computed a confidence interval each time, approximately 95% of those intervals would contain the true population mean. It does not mean there is a 95% probability the true mean lies in this specific interval — once calculated, the interval either contains the true value or it does not.
Confidence intervals are widely used in scientific research, clinical trials, survey statistics, quality control, and data analysis to communicate the precision of estimates.
Confidence Interval Formula
For the Mean (Known Population SD)
When you know the population standard deviation (σ) or have a large sample (n ≥ 30), use the z-distribution:
Step 1: Calculate Standard Error
SE = σ / √n
where σ = standard deviation, n = sample size
Step 2: Calculate Margin of Error
MOE = z × SE
where z = critical value from the standard normal distribution
Step 3: Calculate CI Bounds
CI = x̄ ± MOE
Lower = x̄ − MOE
Upper = x̄ + MOE
Worked Example
Sample mean x̄ = 50, standard deviation σ = 10, sample size n = 100, confidence level = 95%:
SE = 10 / √100 = 10 / 10 = 1.000
z (95%) = 1.960
MOE = 1.960 × 1.000 = 1.960
Lower = 50 − 1.960 = 48.040
Upper = 50 + 1.960 = 51.960
95% CI = [48.040, 51.960]
Z-Score Critical Values Table
The critical z-value (z*) corresponds to the confidence level. It is the number of standard errors from the mean that captures the central area of the normal distribution equal to the confidence level.
| Confidence Level | Alpha (α) | α/2 | Z-Score (z*) |
|---|---|---|---|
| 80% | 0.20 | 0.10 | 1.282 |
| 85% | 0.15 | 0.075 | 1.440 |
| 90% | 0.10 | 0.05 | 1.645 |
| 95% ★ | 0.05 | 0.025 | 1.960 |
| 99% | 0.01 | 0.005 | 2.576 |
| 99.9% | 0.001 | 0.0005 | 3.291 |
★ Industry standard for most research
How to Interpret a Confidence Interval
Interpreting a confidence interval correctly is one of the most important — and most misunderstood — skills in statistics.
Correct Interpretation
A 95% confidence interval means: if you repeated the sampling procedure many times and constructed a confidence interval from each sample, approximately 95% of those intervals would contain the true population parameter.
Common Misconceptions
- Wrong:“There is a 95% probability the true mean is in [48, 52].” — The true mean is a fixed value; it either is or is not in the interval.
- Wrong:“95% of the data falls in this range.” — That describes a prediction interval, not a confidence interval.
- Right:“I used a procedure that produces intervals containing the true parameter 95% of the time.”
Practical Guidance
- A narrower CI indicates more precision (larger n or smaller σ)
- A wider CI indicates more uncertainty (smaller n or larger σ)
- If a CI for a difference excludes zero, the difference is statistically significant
- Higher confidence levels produce wider intervals
Understanding Margin of Error
The margin of error (MOE) is half the width of the confidence interval. It quantifies the maximum expected difference between the sample estimate and the true population value at the given confidence level.
The margin of error is computed as:
MOE = z* × (σ / √n)
Factors that reduce the margin of error:
- Larger sample size (n) — MOE decreases proportionally to 1/√n
- Smaller population variability (σ) — More homogeneous populations yield tighter intervals
- Lower confidence level — Trading certainty for precision
In polling, a MOE of ±3% at 95% confidence is typical for 1,000-person surveys. To halve the MOE, you need to quadruple the sample size.
How Sample Size Affects the Confidence Interval
Sample size has a powerful effect on the width of confidence intervals. Because the standard error formula is σ/√n, doubling the sample size reduces the standard error by about 29% (a factor of √2 ≈ 1.414).
| Sample Size (n) | SE (σ=10) | MOE @ 95% | 95% CI Width |
|---|---|---|---|
| 25 | 2.000 | 3.920 | 7.840 |
| 100 | 1.000 | 1.960 | 3.920 |
| 400 | 0.500 | 0.980 | 1.960 |
| 1,000 | 0.316 | 0.620 | 1.240 |
Notice that going from n=25 to n=100 (4× larger) halves the CI width. This diminishing return means very large samples are expensive to collect for marginal precision gains.
Confidence Interval for a Proportion
When estimating a population proportion (e.g., the fraction of voters who support a candidate, or the defect rate in manufacturing), the formula changes slightly because the standard error depends on the proportion itself.
Proportion CI Formula (Wald method)
p̂ = successes / n
SE = √(p̂(1 − p̂) / n)
CI = p̂ ± z* × SE
Example
In a survey of 200 people, 60 prefer product A. What is the 95% CI for the true proportion?
p̂ = 60 / 200 = 0.30 (30%)
SE = √(0.30 × 0.70 / 200) = √(0.00105) ≈ 0.03240
MOE = 1.960 × 0.03240 ≈ 0.06350
Lower = 0.30 − 0.0635 = 23.65%
Upper = 0.30 + 0.0635 = 36.35%
95% CI = [23.65%, 36.35%]
Note: The bounds are clamped to [0, 1] since proportions cannot be negative or exceed 100%. For proportions near 0 or 1, consider the Wilson score interval for better coverage.