p̂ 样本比例 p̂ 计算器(标准误与置信区间)P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval)
由成功次数 x 和样本量 n 算样本比例 p̂ = x/n、q̂ = 1 − p̂、标准误 √(p̂q̂/n),并给出 90%、95% 或 99% 的 Wald 与 Wilson 置信区间,检查正态近似条件 np̂ ≥ 10、nq̂ ≥ 10。本地处理。From the successes x and the sample size n, get the sample proportion p̂ = x/n, q̂ = 1 − p̂, the standard error √(p̂q̂/n) and a 90%, 95% or 99% Wald and Wilson confidence interval, with a check of the normal-approximation condition np̂ ≥ 10 and nq̂ ≥ 10. Processed locally.
使用说明与常见问题How-to & FAQ
「样本比例 p̂ 计算器(标准误与置信区间)」是什么?What is the P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) tool?
由成功次数 x 和样本量 n 算样本比例 p̂ = x/n、q̂ = 1 − p̂、标准误 √(p̂q̂/n),并给出 90%、95% 或 99% 的 Wald 与 Wilson 置信区间,检查正态近似条件 np̂ ≥ 10、nq̂ ≥ 10。本地处理。From the successes x and the sample size n, get the sample proportion p̂ = x/n, q̂ = 1 − p̂, the standard error √(p̂q̂/n) and a 90%, 95% or 99% Wald and Wilson confidence interval, with a check of the normal-approximation condition np̂ ≥ 10 and nq̂ ≥ 10. Processed locally.
如何使用「样本比例 p̂ 计算器(标准误与置信区间)」?How do I use the P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) tool?
在「样本比例 p̂ 计算器(标准误与置信区间)」中,填写「成功次数 x」、「样本量 n」、「置信水平」等参数,结果会随输入实时计算并显示在下方。In the P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval): Fill in "Successes x", "Sample size n", "Confidence level"; results are recalculated instantly as you type.
p̂ 是什么?What is p-hat?
p̂(读作 p hat)是样本比例,用来估计总体比例 p:p̂ = 成功次数 ÷ 样本量。例如调查 100 人有 42 人赞成,p̂ = 0.42。p̂ (p-hat) is the sample proportion, an estimate of the population proportion p: p̂ = successes ÷ sample size. If 42 of 100 people agree, p̂ = 0.42.
Wald 和 Wilson 区间有什么区别?How do the Wald and Wilson intervals differ?
Wald 区间 p̂ ± z·√(p̂q̂/n) 是教科书常用公式,但样本小或 p̂ 接近 0、1 时覆盖率偏低。Wilson 区间在这些情况下更准确,样本大时两者几乎相同。The Wald interval p̂ ± z·√(p̂q̂/n) is the usual textbook formula, but it covers too little when the sample is small or p̂ is near 0 or 1. The Wilson interval is more accurate there, and the two almost match for large samples.
什么时候能用正态近似?When can I use the normal approximation?
常用条件是 np̂ ≥ 10 且 n(1 − p̂) ≥ 10(有些教材用 5)。不满足时页面会提示,并建议用 Wilson 区间。The usual condition is np̂ ≥ 10 and n(1 − p̂) ≥ 10 (some textbooks use 5). If it fails the page says so and points you to the Wilson interval.
能举个计算实例吗?Can you show a worked example?
例如在「样本比例 p̂ 计算器(标准误与置信区间)」中填 成功次数 x = 25,样本量 n = 100,置信水平 = 95%,结果区显示:样本比例 p̂ = x/n:0.25(25%);q̂ = 1 − p̂:0.75;标准误 SE = √(p̂q̂/n):0.043301;95% Wald 区间 p̂ ± z·SE(z = 1.96):[0.1651, 0.3349];误差范围 z·SE:0.0849;95% Wilson 区间:[0.1755, 0.343];✔ np̂ = 25、nq̂ = 75 都 ≥ 10,正态近似可用For example, entering Successes x = 25, Sample size n = 100, Confidence level = 95% in the P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) gives: Sample proportion p̂ = x/n: 0.25 (25%); q̂ = 1 − p̂: 0.75; Standard error SE = √(p̂q̂/n): 0.043301; 95% Wald interval p̂ ± z·SE (z = 1.96): [0.1651, 0.3349]; Margin of error z·SE: 0.0849; 95% Wilson interval: [0.1755, 0.343]; ✔ np̂ = 25 and nq̂ = 75 are both…
哪些输入会被检查?Which inputs are validated?
「样本比例 p̂ 计算器(标准误与置信区间)」会检查这些输入——「成功次数 x」:必须填写,不能为负数;「样本量 n」:必须填写,须大于 0,须为整数;绝对值超过 10¹⁵ 的数也会被拒绝。不符合时结果区显示具体提示,不会给出数字。The P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) checks its inputs — "Successes x": required, cannot be negative; "Sample size n": required, must be greater than 0, must be a whole number; numbers above 10¹⁵ in absolute value are rejected too. When a value fails, the result area names the problem instead of showing a number.
有哪些选项可以调整?What options can I adjust?
「样本比例 p̂ 计算器(标准误与置信区间)」的设置:「成功次数 x」默认 42;「样本量 n」默认 100;「置信水平」可选 90%、95%、99%(默认 95%)。每次生成结果都按当前设置处理。Settings in the P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) — "Successes x" default 42; "Sample size n" default 100; "Confidence level": 90%, 95%, 99% (default 95%). The result always uses the current settings.
计算精度如何?How precise are the results?
「样本比例 p̂ 计算器(标准误与置信区间)」使用 JavaScript 双精度浮点数(约 15–16 位有效数字);极大或极小的数值可能存在精度误差。The P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) uses double-precision floating point (about 15–16 significant digits); very large or very small values may lose precision.
「样本比例 p̂ 计算器(标准误与置信区间)」免费吗?需要注册吗?Is the P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) free? Do I need an account?
「样本比例 p̂ 计算器(标准误与置信区间)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The P-Hat Calculator (Sample Proportion, Standard Error & Confidence Interval) is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.