The Lady Tasting Teaचाय चखने वाली महिला品茶的女士
Rothamsted research station, England, in the early 1920s. A group of scientists are having afternoon tea. A colleague — the algae expert Dr Muriel Bristol — says she can tell, just by tasting, whether the milk was poured before or after the tea. The statistician Ronald Fisher doubts it. So he designs a fair test.
Rothamsted research station, England, 1920 के दशक की शुरुआत। कुछ वैज्ञानिक दोपहर की चाय पी रहे हैं। एक सहकर्मी — शैवाल (algae) विशेषज्ञ Dr Muriel Bristol — कहती हैं कि वे सिर्फ़ चखकर बता सकती हैं कि दूध चाय से पहले डाला गया या बाद में। Statistician Ronald Fisher को शक है। इसलिए वे एक निष्पक्ष test बनाते हैं।
20 世纪 20 年代初,英国洛桑(Rothamsted)研究站。一群科学家在喝下午茶。一位同事 —— 藻类专家 Muriel Bristol 博士 —— 说她仅凭品尝就能分辨牛奶是在茶之前还是之后倒入的。统计学家罗纳德·费希尔对此表示怀疑,于是他设计了一个公平的检验。
The test uses eight cups: four milk-first and four tea-first, served in random order. She is told there are four of each and must pick the four milk-first cups. If she is only guessing, there are 70 equally likely ways to pick 4 cups out of 8 — and only one of them is fully correct. The story goes that she got all 8 right. The chance of that by pure guessing is 1 in 70 — about 1.4%.
Test में आठ कप हैं: चार milk-first और चार tea-first, random क्रम में। उन्हें बताया जाता है कि हर तरह के चार हैं, और उन्हें चार milk-first कप चुनने हैं। अगर वे सिर्फ़ अंदाज़ा लगा रही हैं, तो 8 में से 4 कप चुनने के 70 बराबर संभावित तरीके हैं — और सिर्फ़ एक पूरी तरह सही है। कहानी के अनुसार उन्होंने सभी 8 सही बताए। सिर्फ़ अंदाज़े से ऐसा होने का chance 70 में 1 — लगभग 1.4% है।
检验用了八杯茶:四杯先加奶、四杯先加茶,随机顺序端上。她被告知每种各四杯,要挑出四杯先加奶的。如果她只是瞎猜,从 8 杯中挑 4 杯共有 70 种等可能的方式 —— 只有一种完全正确。据说她8 杯全对。纯靠猜做到这一点的概率是 七十分之一 —— 约 1.4%。
Fisher's reasoning: "If she had no ability at all, the chance of getting all 8 cups right by luck is only 1.4%." That small number was the evidence. Fisher wrote this experiment up in his 1935 book The Design of Experiments. p-values existed before him, but the Lady Tasting Tea is still the clearest picture of what a p-value measures: how surprising the result would be if there were nothing going on.
Fisher का तर्क: "अगर उनमें कोई क्षमता नहीं है, तो किस्मत से सभी 8 कप सही होने का chance सिर्फ़ 1.4% है।" वही छोटी संख्या सबूत थी। Fisher ने यह प्रयोग अपनी 1935 की किताब The Design of Experiments में लिखा। p-values उनसे पहले भी थे, पर Lady Tasting Tea आज भी सबसे साफ़ तस्वीर है कि p-value क्या मापता है: अगर कुछ भी न हो रहा हो, तो नतीजा कितना चौंकाने वाला होता।
费希尔的推理是:“如果她根本没有这种能力,仅凭运气 8 杯全对的概率只有 1.4%。”这个小数字就是证据。费希尔在 1935 年的著作《实验设计》中记述了这个实验。p 值在他之前就已存在,但“女士品茶”至今仍是理解 p 值最清晰的画面:如果什么都没发生,这个结果会有多令人意外。
A pure guesser picks 4 of the 8 cups at random. Watch one guesser, then run 1,000. How often does a guesser get all 8 right? That share is the p-value.
एक शुद्ध अंदाज़ा लगाने वाला 8 में से 4 कप random चुनता है। एक guesser देखें, फिर 1,000 चलाएँ। कितनी बार guesser सभी 8 सही बताता है? वही हिस्सा p-value है।
一位纯猜测者从 8 杯中随机挑 4 杯。先看一位猜测者,再模拟 1,000 位。猜测者 8 杯全对的比例有多大?这个比例就是 p 值。
The p-value is probably the most used — and most misunderstood — number in science. It appears in medical journals, psychology studies, A/B test reports and quality dashboards. Knowing what it means, and what it does not mean, is one of the most useful skills a data scientist can have.
p-value शायद विज्ञान की सबसे ज़्यादा इस्तेमाल होने वाली — और सबसे ज़्यादा ग़लत समझी जाने वाली — संख्या है। यह medical journals, psychology studies, A/B test reports और quality dashboards में दिखता है। इसका मतलब, और यह क्या नहीं बताता, जानना एक data scientist का सबसे उपयोगी हुनर है।
p 值可能是科学界用得最多、也最常被误解的数字。它出现在医学期刊、心理学研究、A/B 测试报告和质量看板中。理解它的含义,以及它不代表什么,是数据科学家最有用的技能之一。
What Exactly Is a p-value?p-value असल में क्या है?p 值到底是什么?
Try a thought experiment first. You suspect a coin favours heads. You flip it 10 times and get 9 heads. Ask: "If this coin were perfectly fair, how often would I see a result this extreme just by chance?" The answer is the p-value.
पहले एक सोच-प्रयोग करें। आपको शक है कि coin heads की ओर झुका है। आप उसे 10 बार उछालते हैं और 9 heads आते हैं। पूछें: "अगर यह coin पूरी तरह fair होता, तो सिर्फ़ संयोग से इतना extreme नतीजा कितनी बार दिखता?" इसका जवाब p-value है।
先做个思想实验。你怀疑一枚硬币偏向正面。你抛了 10 次,得到 9 次正面。问自己:“如果这枚硬币完全公平,仅凭偶然看到这么极端的结果的频率有多高?”答案就是 p 值。
The p-value is the probability of getting a test statistic at least as extreme as the one observed, assuming the null hypothesis H₀ is true.
p = P( data this extreme or more extreme | H₀ is true )
It answers one question only: "How surprising is this data, if nothing is going on?"
p-value कम से कम देखे गए जितना extreme test statistic मिलने की probability है, यह मानकर कि null hypothesis H₀ सच है।
p = P( इतना या इससे ज़्यादा extreme data | H₀ सच है )
यह सिर्फ़ एक सवाल का जवाब देता है: "अगर कुछ भी नहीं हो रहा, तो यह data कितना चौंकाने वाला है?"
p 值是:假设原假设 H₀ 为真时,得到至少与观测值一样极端的检验统计量的概率。
p = P(数据至少这么极端 | H₀ 为真)
它只回答一个问题:“如果什么都没发生,这些数据有多令人意外?”
- Data are surprising under H₀H₀ के तहत data चौंकाने वाला在 H₀ 下数据令人意外
- Evidence against H₀H₀ के ख़िलाफ़ सबूत反驳 H₀ 的证据
- Reject H₀ if p < αp < α हो तो H₀ rejectp < α 则拒绝 H₀
- "Statistically significant""Statistically significant"“统计显著”
- Data are not surprising under H₀H₀ के तहत data चौंकाने वाला नहीं在 H₀ 下数据不意外
- Weak evidence against H₀H₀ के ख़िलाफ़ कमज़ोर सबूत反驳 H₀ 的证据较弱
- Fail to reject H₀H₀ reject नहीं不拒绝 H₀
- Not proof that H₀ is trueH₀ के सच होने का सबूत नहीं不能证明 H₀ 为真
- Set before the experimentप्रयोग से पहले तय实验前设定
- A convention, not magicपरंपरा है, जादू नहीं是惯例,不是魔法
- Stricter (e.g. 0.01) when false alarms are costlyझूठा alarm महँगा हो तो सख़्त (जैसे 0.01)误报代价高时更严(如 0.01)
- p < α → reject H₀p < α → H₀ rejectp < α → 拒绝 H₀
The p-value in Pictures — Understand Before the Mathsतस्वीरों में p-value — गणित से पहले समझें图解 p 值 — 先理解,再算数
Every p-value is built the same way. Imagine the world where H₀ is true. List everything that could happen there and how likely it is. Then add up the chances of everything at least as extreme as what you actually saw.
हर p-value एक ही तरह बनता है। उस दुनिया की कल्पना करें जहाँ H₀ सच है। वहाँ जो कुछ हो सकता है और उसकी संभावना, सब लिखें। फिर जो आपने असल में देखा, उससे कम से कम उतना extreme हर चीज़ के chances जोड़ें।
每个 p 值的构造方式都一样:想象 H₀ 为真的世界,列出那里可能发生的一切及其概率,然后把至少与你实际看到的一样极端的所有情况的概率加起来。
The further the test statistic is from 0, the smaller the shaded tails, the smaller p, and the stronger the evidence against H₀.
Test statistic, 0 से जितना दूर, छायांकित tails उतनी छोटी, p उतना छोटा, और H₀ के ख़िलाफ़ सबूत उतना मज़बूत।
检验统计量离 0 越远,阴影尾部越小,p 越小,反驳 H₀ 的证据越强。
The Coin Flip — A Visual WalkthroughCoin Flip — एक visual walkthrough抛硬币 — 图解演示
We flip a coin 10 times and see 9 heads. H₀: the coin is fair, P(heads) = 0.5. We use a two-tailed test, because a coin biased towards tails would be just as interesting. So "at least as extreme" means 9 or 10 heads or 0 or 1 heads.
हम coin 10 बार उछालते हैं और 9 heads देखते हैं। H₀: coin fair है, P(heads) = 0.5. हम two-tailed test लेते हैं, क्योंकि tails की ओर झुका coin भी उतना ही दिलचस्प होता। इसलिए "कम से कम इतना extreme" का मतलब है 9 या 10 heads या 0 या 1 heads.
我们抛 10 次硬币,看到 9 次正面。H₀:硬币公平,P(正面) = 0.5。我们用双侧检验,因为偏向反面的硬币同样值得关注。所以“至少一样极端”指 9 或 10 次正面,或 0 或 1 次正面。
The bars show every possible result of 10 fair flips. The red bars are the results at least as extreme as 9 heads. There are 1 + 10 + 10 + 1 = 22 such sequences out of 2¹⁰ = 1,024, so p = 22/1,024 ≈ 0.021.
Since 0.021 < α = 0.05, we reject H₀. But 2.1% is not zero: a fair coin gives a result this extreme about 1 time in 47. If the coin really is fair, our rejection is a Type I error. Note that this is not "a 2.1% chance the coin is fair" — the p-value cannot tell you that.
Bars, 10 fair flips के हर संभव नतीजे दिखाते हैं। लाल bars वे नतीजे हैं जो कम से कम 9 heads जितने extreme हैं। 2¹⁰ = 1,024 में से ऐसे 1 + 10 + 10 + 1 = 22 sequences हैं, इसलिए p = 22/1,024 ≈ 0.021.
क्योंकि 0.021 < α = 0.05, हम H₀ reject करते हैं। पर 2.1% शून्य नहीं है: fair coin भी लगभग 47 में 1 बार इतना extreme नतीजा देता है। अगर coin सच में fair है, तो हमारा reject करना Type I error है। ध्यान दें, इसका मतलब "coin के fair होने का 2.1% chance" नहीं है — p-value यह नहीं बता सकता।
柱子显示公平硬币抛 10 次的所有可能结果。红色柱是与 9 次正面至少一样极端的结果。在 2¹⁰ = 1,024 种序列中有 1 + 10 + 10 + 1 = 22 种,所以 p = 22/1,024 ≈ 0.021。
由于 0.021 < α = 0.05,我们拒绝 H₀。但 2.1% 不是零:公平硬币大约每 47 次就会出现一次这么极端的结果。如果硬币真的公平,我们的拒绝就是第一类错误。注意,这不是“硬币公平的概率为 2.1%” —— p 值无法告诉你这一点。
Choose the number of flips and the number of heads you observed. The red bars add up to the exact p-value. Then flip a fair coin (animated) many times and count how often it is at least as extreme — the share matches p.
Flips की संख्या और देखे गए heads चुनें। लाल bars का जोड़ सटीक p-value है। फिर fair coin को (animated) कई बार उछालें और गिनें कि कितनी बार नतीजा कम से कम इतना extreme है — वह हिस्सा p से मेल खाता है।
选择抛掷次数和观测到的正面数。红色柱之和就是精确的 p 值。然后(动画)多次抛一枚公平硬币,数一数有多少次至少同样极端 —— 这个比例与 p 吻合。
The p-value on a Normal CurveNormal Curve पर p-value正态曲线上的 p 值
For continuous data — means, differences — the p-value is an area under the normal (or t) curve. The test statistic (a z-score or t-value) says how many standard errors your result sits from the H₀ value. The p-value is the area in the tail(s) beyond that point.
Continuous data — means, अंतर — के लिए p-value, normal (या t) curve के नीचे का area है। Test statistic (z-score या t-value) बताता है कि आपका नतीजा H₀ value से कितने standard errors दूर है। p-value उस बिंदु के आगे की tail(s) का area है।
对于连续数据(均值、差异),p 值是正态(或 t)曲线下的一块面积。检验统计量(z 分数或 t 值)表示你的结果离 H₀ 值有几个标准误。p 值就是该点之外尾部的面积。
Drag z, or press play to watch z slide from 0 to 3.5. The red tail area — the p-value — shrinks fast, and the marker moves along the evidence scale.
z को खिसकाएँ, या play दबाकर z को 0 से 3.5 तक जाते देखें। लाल tail area — p-value — तेज़ी से घटता है, और marker सबूत के पैमाने पर चलता है।
拖动 z,或点播放看 z 从 0 滑到 3.5。红色尾部面积(p 值)迅速缩小,标记沿证据刻度移动。
The p-value is the area of the tail(s) beyond your test statistic, under the curve that shows what would happen if H₀ were true. The further your result is from the centre, the smaller that area, the smaller p, and the stronger the case against H₀.
p-value आपके test statistic के आगे की tail(s) का area है, उस curve के नीचे जो दिखाता है कि H₀ सच होने पर क्या होता। नतीजा केंद्र से जितना दूर, area उतना छोटा, p उतना छोटा, और H₀ के ख़िलाफ़ केस उतना मज़बूत।
p 值就是在“若 H₀ 为真会发生什么”的曲线下,检验统计量之外尾部的面积。结果离中心越远,面积越小,p 越小,反驳 H₀ 的理由越充分。
What the p-value Is NOT — Six Mythsp-value क्या नहीं है — छह भ्रमp 值不是什么 — 六大误区
In 2016 the American Statistical Association published its first-ever formal statement on a specific matter of statistical practice: the p-value. It gave six principles to stop common misuse. The myths below are closely linked to those principles.
2016 में American Statistical Association ने statistical practice के किसी ख़ास विषय पर अपना पहला औपचारिक बयान जारी किया: p-value. इसमें आम ग़लत इस्तेमाल रोकने के लिए छह सिद्धांत थे। नीचे के भ्रम उन्हीं सिद्धांतों से जुड़े हैं।
2016 年,美国统计协会首次就某一具体统计实践问题发表正式声明:p 值。声明提出六条原则,以纠正常见的误用。下面的误区与这些原则密切相关。
| Mythभ्रम误区 | The truthसच्चाई真相 |
|---|---|
| ❌ "p = 0.03 means a 3% chance that H₀ is true.""p = 0.03 मतलब H₀ के सच होने का 3% chance."“p = 0.03 表示 H₀ 为真的概率是 3%。” | ✅ p is computed assuming H₀ is true, so it cannot give the chance that H₀ is true. That needs prior information and Bayesian methods.p, H₀ को सच मानकर निकाला जाता है, इसलिए यह H₀ के सच होने का chance नहीं दे सकता। उसके लिए पहले की जानकारी और Bayesian methods चाहिए।p 是在假设 H₀ 为真的前提下算出的,所以无法给出 H₀ 为真的概率。那需要先验信息和贝叶斯方法。 |
| ❌ "p < 0.05 means the result is important.""p < 0.05 मतलब नतीजा ज़रूरी है।"“p < 0.05 说明结果很重要。” | ✅ With a big enough sample, a tiny, useless difference gives a tiny p. Significance ≠ importance. Report an effect size.काफ़ी बड़े sample में छोटा, बेकार अंतर भी बहुत छोटा p देता है। Significance ≠ महत्व। Effect size बताएँ।样本足够大时,微小而无用的差异也能得到很小的 p。显著 ≠ 重要。要报告效应量。 |
| ❌ "p ≥ 0.05 means there is no effect.""p ≥ 0.05 मतलब कोई effect नहीं।"“p ≥ 0.05 说明没有效应。” | ✅ The study may have been too small to see a real effect. Absence of evidence is not evidence of absence.Study असली effect देखने के लिए बहुत छोटी हो सकती है। सबूत का न होना, न होने का सबूत नहीं।研究可能太小,看不到真实效应。没有证据不等于没有效应的证据。 |
| ❌ "p = 0.049 is a real finding, but p = 0.051 is not.""p = 0.049 असली खोज है, पर p = 0.051 नहीं।"“p = 0.049 是真发现,p = 0.051 就不是。” | ✅ They are almost identical evidence. 0.05 is a convention, not a line between truth and falsehood.ये लगभग एक जैसे सबूत हैं। 0.05 एक परंपरा है, सच और झूठ के बीच की रेखा नहीं।两者的证据几乎相同。0.05 是惯例,不是真与假的分界线。 |
| ❌ "If I repeat the study, I will get p < 0.05 again.""Study दोहराऊँ तो फिर p < 0.05 मिलेगा।"“重复研究,还会得到 p < 0.05。” | ✅ p-values jump around a lot between studies, even when the effect is real. With 50% power, a true finding is "replicated" only half the time. See the dance below.असली effect होने पर भी p-values studies के बीच बहुत उछलते हैं। 50% power पर सच्ची खोज भी आधी बार ही "दोहराई" जाती है। नीचे का नाच देखें।即使效应真实存在,p 值在不同研究间也会大幅跳动。检验力 50% 时,真实发现也只有一半的概率被“重复”出来。看下面的“p 值之舞”。 |
| ❌ "A smaller p means a bigger effect.""छोटा p मतलब बड़ा effect."“p 越小,效应越大。” | ✅ p depends on effect size and sample size together. For a one-sample t-test, t = d × √n: a small d with a huge n can beat a large d with a small n.p, effect size और sample size दोनों पर निर्भर है। One-sample t-test में t = d × √n: बहुत बड़े n के साथ छोटा d, छोटे n के साथ बड़े d को हरा सकता है।p 同时取决于效应量和样本量。单样本 t 检验中 t = d × √n:小 d 配上巨大的 n,可以胜过大 d 配上小 n。 |
A tiny p can come from a huge sample detecting a trivial effect. A large p can come from a small study that missed a real, large effect. Because t = d × √n, the p-value alone cannot tell you which is happening. That is why reporting an effect size and a confidence interval is essential, not optional.
छोटा p बहुत बड़े sample से आ सकता है जिसने मामूली effect पकड़ा। बड़ा p छोटी study से आ सकता है जो असली, बड़ा effect चूक गई। क्योंकि t = d × √n, अकेला p-value नहीं बता सकता कि इनमें से क्या हो रहा है। इसीलिए effect size और confidence interval बताना ज़रूरी है, वैकल्पिक नहीं।
极小的 p 可能来自巨大样本检测到的微不足道的效应;较大的 p 可能来自小研究错过了真实而大的效应。因为 t = d × √n,仅凭 p 值无法判断是哪种情况。所以报告效应量和置信区间是必需的,而不是可选的。
Press play. Each dot is a new study with the same true effect and the same n. Watch how wildly p jumps between studies — and how the share below 0.05 matches the power.
Play दबाएँ। हर dot एक नई study है, वही असली effect और वही n. देखें कि studies के बीच p कितना उछलता है — और 0.05 से नीचे का हिस्सा power से कैसे मेल खाता है।
点击播放。每个点是一项真实效应和 n 都相同的新研究。看看 p 在研究之间跳得多厉害 —— 以及低于 0.05 的比例如何与检验力吻合。
The p-value Scale — How to Read the Evidencep-value का पैमाना — सबूत कैसे पढ़ेंp 值刻度 — 如何解读证据
Not all significant results are equally convincing, and not all non-significant results are equally weak. Many statisticians use rough labels to describe the strength of evidence. Fisher himself treated p as a smooth measure of evidence and suggested 0.05 only as a convenient guide — the labels below are a common modern convention, not a law.
हर significant नतीजा बराबर भरोसेमंद नहीं, और हर non-significant नतीजा बराबर कमज़ोर नहीं। कई statisticians सबूत की ताक़त बताने के लिए मोटे labels इस्तेमाल करते हैं। Fisher ख़ुद p को सबूत का लगातार माप मानते थे और 0.05 को सिर्फ़ सुविधाजनक मार्गदर्शक बताते थे — नीचे के labels एक आम आधुनिक परंपरा हैं, क़ानून नहीं।
并非所有显著结果都同样有说服力,也并非所有不显著结果都同样无力。许多统计学家用粗略的标签描述证据强度。费希尔本人把 p 视为连续的证据量度,只把 0.05 当作方便的参考 —— 下面的标签是现代常用惯例,而非定律。
| p-value rangep-value rangep 值范围 | Strength of evidenceसबूत की ताक़त证据强度 | Decision at α = 0.05α = 0.05 पर फ़ैसलाα = 0.05 时的决定 | Exampleउदाहरण例子 |
|---|---|---|---|
| p < 0.001 | Very strong against H₀H₀ के ख़िलाफ़ बहुत मज़बूत强烈反驳 H₀ | Reject H₀H₀ reject拒绝 H₀ | Large vaccine trialबड़ा vaccine trial大型疫苗试验 |
| 0.001 ≤ p < 0.01 | Strong against H₀H₀ के ख़िलाफ़ मज़बूत有力反驳 H₀ | Reject H₀H₀ reject拒绝 H₀ | Drug lowers cholesterolदवा cholesterol घटाती है药物降低胆固醇 |
| 0.01 ≤ p < 0.05 | Moderate against H₀H₀ के ख़िलाफ़ मध्यम中等程度反驳 H₀ | Reject H₀H₀ reject拒绝 H₀ | Coin: 9 heads in 10 (p = 0.021)Coin: 10 में 9 heads (p = 0.021)硬币:10 次中 9 次正面(p = 0.021) |
| 0.05 ≤ p < 0.10 | Weakकमज़ोर较弱 | Fail to reject H₀H₀ reject नहीं不拒绝 H₀ | A hint worth a bigger studyबड़ी study लायक़ संकेत值得更大研究的迹象 |
| p ≥ 0.10 | Little or noneबहुत कम या नहीं很少或没有 | Fail to reject H₀H₀ reject नहीं不拒绝 H₀ | No difference detected (which is not "no difference")कोई अंतर नहीं मिला (जो "कोई अंतर नहीं" के बराबर नहीं)未检测到差异(不等于“没有差异”) |
Step by Step: Computing a p-value by HandStep by Step: हाथ से p-value निकालना一步一步手算 p 值
A hospital claims its average patient wait is 30 minutes. An auditor thinks it is longer. She samples 40 patients at random and finds x̄ = 34.2 minutes and s = 10.5 minutes. Is that enough evidence against the claim?
एक अस्पताल का दावा है कि मरीज़ों का औसत इंतज़ार 30 मिनट है। एक auditor को लगता है कि यह ज़्यादा है। वह random 40 मरीज़ लेती है और x̄ = 34.2 मिनट, s = 10.5 मिनट पाती है। क्या यह दावे के ख़िलाफ़ काफ़ी सबूत है?
一家医院声称患者平均等待 30 分钟。审计员认为更长。她随机抽取 40 名患者,得到 x̄ = 34.2 分钟、s = 10.5 分钟。这足以反驳医院的说法吗?
H₀: μ ≤ 30 minutes | H₁: μ > 30 minutes (right-tailed)
H₀: μ ≤ 30 मिनट | H₁: μ > 30 मिनट (right-tailed)
H₀:μ ≤ 30 分钟 | H₁:μ > 30 分钟(右侧)
α = 0.05. σ unknown → t-test, df = n − 1 = 39.
α = 0.05. σ अज्ञात → t-test, df = n − 1 = 39.
α = 0.05。σ 未知 → t 检验,df = n − 1 = 39。
SE = s / √n = 10.5 / √40 = 10.5 / 6.325 = 1.660 min
SE = s / √n = 10.5 / √40 = 10.5 / 6.325 = 1.660 min
SE = s / √n = 10.5 / √40 = 10.5 / 6.325 = 1.660 分钟
t = (x̄ − μ₀) / SE = (34.2 − 30) / 1.660 = t = 2.530
t = (x̄ − μ₀) / SE = (34.2 − 30) / 1.660 = t = 2.530
t = (x̄ − μ₀) / SE = (34.2 − 30) / 1.660 = t = 2.530
Right-tailed: p = P(T > 2.530 | df = 39) = 0.0078 (
stats.t.sf(2.530, 39))Right-tailed: p = P(T > 2.530 | df = 39) = 0.0078 (
stats.t.sf(2.530, 39))右侧:p = P(T > 2.530 | df = 39) = 0.0078(
stats.t.sf(2.530, 39))There is strong evidence (p = 0.008) that the true mean wait is over 30 minutes. Effect size: about 4.2 minutes longer (d = 0.40, small-to-medium); 95% CI for the mean wait 30.8 to 37.6 minutes.
मज़बूत सबूत है (p = 0.008) कि असली औसत इंतज़ार 30 मिनट से ज़्यादा है। Effect size: लगभग 4.2 मिनट ज़्यादा (d = 0.40, small-to-medium); औसत इंतज़ार का 95% CI 30.8 से 37.6 मिनट।
有强证据(p = 0.008)表明真实平均等待超过 30 分钟。效应量:约长 4.2 分钟(d = 0.40,小到中等);平均等待时间的 95% 置信区间为 30.8 到 37.6 分钟。
Three things together: the size of the difference (4.2 minutes), the spread of the data (s = 10.5) and the sample size (n = 40). With only 10 patients, SE would be 3.32, t = 1.27 and p ≈ 0.12 — not significant. Same difference, different conclusion, only because of n.
तीन चीज़ें मिलकर: अंतर का आकार (4.2 मिनट), data का फैलाव (s = 10.5) और sample size (n = 40)। सिर्फ़ 10 मरीज़ों पर SE = 3.32, t = 1.27 और p ≈ 0.12 होता — significant नहीं। वही अंतर, अलग निष्कर्ष, सिर्फ़ n की वजह से।
三者共同决定:差异大小(4.2 分钟)、数据的离散程度(s = 10.5)和样本量(n = 40)。如果只有 10 名患者,SE = 3.32,t = 1.27,p ≈ 0.12 —— 不显著。同样的差异,结论不同,只因为 n 不同。
Python ImplementationPython ImplementationPython 实现
Exact p-values for the tea and coin examplesचाय और coin उदाहरणों के सटीक p-values品茶与抛硬币的精确 p 值
from math import comb
from scipy import stats
# Lady Tasting Tea: 8 cups, 4 milk-first. She must pick the 4 milk-first cups.
ways = comb(8, 4) # 70 ways to choose 4 cups
print(f"Ways to choose 4 cups of 8: {ways}")
print(f"P(all 8 right by guessing) = 1/{ways} = {1/ways:.4f}")
# Coin: 9 heads in 10 flips, H₀: P(heads) = 0.5
res = stats.binomtest(9, n=10, p=0.5, alternative='two-sided')
print(f"Coin, two-tailed p-value = {res.pvalue:.4f} (11 + 11 outcomes of 1,024)")
p-value from first principles — hospital wait timesशुरुआत से p-value — अस्पताल का इंतज़ार从原理出发求 p 值 —— 医院等待时间
import numpy as np
from scipy import stats
# Hospital wait time example
# H0: mu <= 30 | H1: mu > 30 (right-tailed)
np.random.seed(42)
sample = np.random.normal(loc=34.2, scale=10.5, size=40)
mu_0 = 30
x_bar = np.mean(sample)
s = np.std(sample, ddof=1)
n = len(sample)
se = s / np.sqrt(n)
df = n - 1
# t-statistic
t_stat = (x_bar - mu_0) / se
# p-value: right-tailed = area to the RIGHT of t_stat
p_right = stats.t.sf(t_stat, df=df) # sf = 1 - cdf
# For two-tailed: double the smaller tail
p_two = 2 * stats.t.sf(abs(t_stat), df=df)
# Critical t-value at alpha=0.05, right-tailed
t_crit = stats.t.ppf(0.95, df=df)
print(f"Sample mean x̄: {x_bar:.4f} min")
print(f"Standard Error SE: {se:.4f} min")
print(f"t-statistic: {t_stat:.4f}")
print(f"Degrees of freedom: {df}")
print(f"t-critical (right): {t_crit:.4f}")
print(f"p-value (right-tail): {p_right:.4f}")
print(f"p-value (two-tail): {p_two:.4f}")
print()
print(f"Conclusion: {'REJECT H0' if p_right < 0.05 else 'FAIL TO REJECT H0'}")
This sample was drawn from a population whose true mean is 34.2 minutes — H₀ is false. Yet this particular sample came out with x̄ = 31.9, and p = 0.118. With d = 0.4 and n = 40, the test has only about 80% power, so about 1 study in 5 misses the real effect. This is a Type II error, seen live. One sample is never the whole story.
यह sample उस population से लिया गया जिसका असली mean सच में 34.2 मिनट है — H₀ ग़लत है। फिर भी इस sample में x̄ = 31.9 आया, और p = 0.118. d = 0.4 और n = 40 पर test की power सिर्फ़ लगभग 80% है, यानी लगभग 5 में से 1 study असली effect चूक जाती है। यह सीधा दिखता Type II error है। एक sample कभी पूरी कहानी नहीं होता।
这个样本来自真实均值确实是 34.2 分钟的总体 —— H₀ 是错的。但这个样本恰好得到 x̄ = 31.9,p = 0.118。d = 0.4、n = 40 时,检验力只有约 80%,大约每 5 项研究就有 1 项错过真实效应。这就是活生生的第二类错误。一个样本永远不是全部真相。
What changes the p-value?p-value को क्या बदलता है?什么会改变 p 值?
import numpy as np
from scipy import stats
# How sample size and effect size each change the p-value
mu_0 = 30 # null hypothesis value
x_bar = 34.2 # sample mean (fixed)
s = 10.5 # std dev (fixed)
print("Same effect (4.2 min), same s — only n changes:")
for n in [10, 20, 40, 100, 500]:
se = s / np.sqrt(n)
t_stat = (x_bar - mu_0) / se
p = stats.t.sf(t_stat, df=n-1)
sig = "REJECT H0" if p < 0.05 else "fail to reject"
print(f" n={n:4d} SE={se:.3f} t={t_stat:6.3f} p={p:.2g} {sig}")
print()
print("Same n (40), same s — only the sample mean changes:")
for mean in [30.5, 31.0, 32.0, 34.2, 38.0]:
se = s / np.sqrt(40)
t_stat = (mean - mu_0) / se
p = stats.t.sf(t_stat, df=39)
sig = "REJECT H0" if p < 0.05 else "fail to reject"
print(f" x̄={mean:.1f} t={t_stat:6.3f} p={p:.2g} {sig}")
With the same 4.2-minute difference, p falls from 0.12 to 3.7 × 10⁻¹⁸ as n grows from 10 to 500. The effect did not change at all — only the precision did.
उसी 4.2 मिनट के अंतर पर, n के 10 से 500 होने पर p, 0.12 से 3.7 × 10⁻¹⁸ हो जाता है। Effect बिल्कुल नहीं बदला — सिर्फ़ precision बदली।
差异同样是 4.2 分钟,n 从 10 增至 500 时,p 从 0.12 降到 3.7 × 10⁻¹⁸。效应完全没变 —— 变的只是精度。
A complete report: p-value, CI and effect sizeपूरी report: p-value, CI और effect size完整报告:p 值、置信区间与效应量
import numpy as np
from scipy import stats
def full_test_report(sample, mu_0, alpha=0.05, tail="two"):
"""One-sample t-test with p-value, CI and effect size."""
n = len(sample)
x_bar = np.mean(sample)
s = np.std(sample, ddof=1)
se = s / np.sqrt(n)
df = n - 1
t_stat = (x_bar - mu_0) / se
if tail == "two":
p = 2 * stats.t.sf(abs(t_stat), df=df)
elif tail == "right":
p = stats.t.sf(t_stat, df=df)
else:
p = stats.t.cdf(t_stat, df=df)
lo, hi = stats.t.interval(0.95, df=df, loc=x_bar, scale=se)
d = (x_bar - mu_0) / s # Cohen's d (one sample)
d_label = ("negligible" if abs(d) < 0.2 else "small" if abs(d) < 0.5
else "medium" if abs(d) < 0.8 else "large")
evidence = ("very strong" if p < 0.001 else "strong" if p < 0.01
else "moderate" if p < 0.05 else "weak" if p < 0.10 else "little or none")
print("=" * 52)
print(f" One-sample t-test ({tail}-tailed) H₀: μ = {mu_0}, α = {alpha}")
print("=" * 52)
print(f" n = {n} x̄ = {x_bar:.3f} s = {s:.3f} SE = {se:.3f}")
print(f" t({df}) = {t_stat:.4f} p = {p:.4f}")
print(f" 95% CI for μ: ({lo:.2f}, {hi:.2f})")
print(f" Cohen's d = {d:.3f} ({d_label}) evidence: {evidence}")
verdict = "REJECT H₀" if p < alpha else "FAIL TO REJECT H₀"
print(f" DECISION: {verdict}")
print("=" * 52)
np.random.seed(42)
wait_times = np.random.normal(34.2, 10.5, 40)
full_test_report(wait_times, mu_0=30, alpha=0.05, tail="right")
Why one study is never enoughएक study कभी काफ़ी क्यों नहीं为什么一项研究永远不够
import numpy as np
from scipy import stats
# 1,000 studies where H₁ is TRUE: μ_true = 32, μ₀ = 30, σ = 10.5, n = 40
rng = np.random.default_rng(0)
n_studies, n, mu_true, mu_0, sigma = 1000, 40, 32, 30, 10.5
samples = rng.normal(mu_true, sigma, (n_studies, n))
p_values = stats.ttest_1samp(samples, popmean=mu_0, axis=1).pvalue
print(f"Studies with p < 0.05: {(p_values < 0.05).mean()*100:.1f}%")
print(f"Studies with p ≥ 0.05: {(p_values >= 0.05).mean()*100:.1f}%")
print(f"Median p-value: {np.median(p_values):.3f}")
print(f"Smallest / largest p: {p_values.min():.5f} / {p_values.max():.3f}")
Here H₁ is true (μ = 32, not 30), but the effect is small (d ≈ 0.19). With n = 40 only about 23% of studies reach p < 0.05 — more than three out of four studies miss a real effect. The median p is 0.22. This is the power problem.
यहाँ H₁ सच है (μ = 32, 30 नहीं), पर effect छोटा है (d ≈ 0.19)। n = 40 पर सिर्फ़ लगभग 23% studies में p < 0.05 आता है — चार में से तीन से ज़्यादा studies असली effect चूक जाती हैं। Median p = 0.22. यही power की समस्या है।
这里 H₁ 为真(μ = 32,而不是 30),但效应很小(d ≈ 0.19)。n = 40 时只有约 23% 的研究达到 p < 0.05 —— 四项研究中有三项以上错过了真实效应。p 的中位数是 0.22。这就是检验力问题。
Run 20 independent tests on pure noise at α = 0.05 and you expect about 1 false positive — and the chance of at least one is 64%. Trying many analyses, subgroups or outcomes and reporting only the "significant" one pushes the real error rate far above 5%. This is p-hacking (or data dredging), and it is a major cause of the replication crisis in psychology, medicine and nutrition science. When you run several tests, correct for it (Bonferroni, Holm, or Benjamini–Hochberg).
शुद्ध शोर पर α = 0.05 से 20 स्वतंत्र tests चलाएँ, तो लगभग 1 false positive की उम्मीद है — और कम से कम एक का chance 64% है। कई analyses, subgroups या outcomes आज़माकर सिर्फ़ "significant" वाला बताना असली error rate को 5% से बहुत ऊपर ले जाता है। यह p-hacking (या data dredging) है, और psychology, medicine और nutrition science में replication crisis की बड़ी वजह है। कई tests चलाएँ तो correction करें (Bonferroni, Holm, या Benjamini–Hochberg)।
在纯噪声上以 α = 0.05 做 20 个独立检验,预计约有 1 个假阳性 —— 至少一个的概率为 64%。尝试多种分析、子组或指标,却只报告“显著”的那个,会让真实错误率远超 5%。这就是 p-hacking(数据挖掘),也是心理学、医学和营养学可重复性危机的主要原因。做多个检验时要进行校正(Bonferroni、Holm 或 Benjamini–Hochberg)。
import numpy as np
from scipy import stats
# 20 tests on pure noise, repeated 10,000 times
rng = np.random.default_rng(3)
k, reps, n, alpha = 20, 10_000, 30, 0.05
a = rng.normal(0, 1, (reps, k, n)); b = rng.normal(0, 1, (reps, k, n))
p = stats.ttest_ind(a, b, axis=2).pvalue # shape (reps, k)
print(f"Average false positives per 20 tests: {(p < alpha).sum(axis=1).mean():.2f}")
print(f"P(at least one p < 0.05) — no correction: {(p < alpha).any(axis=1).mean()*100:.1f}%")
print(f"P(at least one p < 0.05/20) — Bonferroni: {(p < alpha / k).any(axis=1).mean()*100:.1f}%")
Every test here is on pure noise — H₀ is true each time. Run k tests and watch red "discoveries" appear by luck. Then switch on Bonferroni.
यहाँ हर test शुद्ध शोर पर है — हर बार H₀ सच है। k tests चलाएँ और देखें कि किस्मत से लाल "खोजें" कैसे आती हैं। फिर Bonferroni चालू करें।
这里每个检验都基于纯噪声 —— 每次 H₀ 都为真。做 k 个检验,看红色“发现”如何凭运气出现。然后打开 Bonferroni 校正。
p-value vs Confidence Interval — Two Sides of One Coinp-value vs Confidence Interval — एक सिक्के के दो पहलूp 值 vs 置信区间 — 一枚硬币的两面
For the usual t-test, a p-value and a confidence interval are built from the same numbers, so they always agree. But the interval also shows how big the effect is and how precisely it is known — so it usually tells you more.
आम t-test में p-value और confidence interval एक ही संख्याओं से बनते हैं, इसलिए हमेशा सहमत होते हैं। पर interval यह भी दिखाता है कि effect कितना बड़ा है और कितनी सटीकता से पता है — इसलिए यह आम तौर पर ज़्यादा बताता है।
对常见的 t 检验,p 值和置信区间由同样的数字构造,所以总是一致。但区间还能显示效应有多大、估计有多精确 —— 因此通常信息更多。
| Propertyगुण性质 | p-value | Confidence intervalConfidence interval置信区间 |
|---|---|---|
| What it givesक्या देता है给出什么 | One number: how surprising the data are under H₀एक संख्या: H₀ के तहत data कितना चौंकाने वाला है一个数:在 H₀ 下数据有多意外 | A range of believable values for the parameterParameter के भरोसेमंद values की range参数的可信取值范围 |
| Shows effect size?Effect size दिखाता है?显示效应量? | Noनहीं否 | Yes — by where the interval sitsहाँ — interval कहाँ है, उससे是 —— 由区间的位置体现 |
| Shows precision?Precision दिखाता है?显示精度? | Noनहीं否 | Yes — narrower = more preciseहाँ — पतला = ज़्यादा सटीक是 —— 越窄越精确 |
| Significance linkSignificance संबंध与显著性的关系 | p < 0.05 | 95% CI does not contain μ₀95% CI में μ₀ नहीं95% 置信区间不含 μ₀ |
| Effect of a bigger nबड़े n का असरn 增大的影响 | p gets smaller for any real differenceकिसी भी असली अंतर पर p छोटा होता है只要有真实差异,p 就变小 | The interval gets narrowerInterval पतला होता है区间变窄 |
| Best practiceसबसे अच्छा तरीका最佳实践 | Report itबताएँ报告它 | Report it too — always bothइसे भी बताएँ — हमेशा दोनों也要报告 —— 两者都要 |
For a two-tailed t-test at α = 0.05 and the matching t-interval:
p < 0.05 exactly when the 95% CI does not contain μ₀.
p ≥ 0.05 exactly when the 95% CI contains μ₀.
(For some other tests, such as proportions, the usual test and interval use slightly different formulas, so they can disagree near the boundary.)
Good practice: always report both. The CI shows how large the effect is and how well you know it; the p-value alone cannot.
α = 0.05 पर two-tailed t-test और उससे मेल खाते t-interval के लिए:
p < 0.05 ठीक तब, जब 95% CI में μ₀ न हो।
p ≥ 0.05 ठीक तब, जब 95% CI में μ₀ हो।
(कुछ दूसरे tests, जैसे proportions, में आम test और interval थोड़े अलग formulas लेते हैं, इसलिए सीमा के पास असहमत हो सकते हैं।)
अच्छा तरीका: हमेशा दोनों बताएँ। CI दिखाता है कि effect कितना बड़ा है और आप उसे कितना अच्छी तरह जानते हैं; अकेला p-value यह नहीं कर सकता।
对 α = 0.05 的双侧 t 检验及对应的 t 区间:
恰好当 95% 置信区间不含 μ₀ 时,p < 0.05。
恰好当 95% 置信区间包含 μ₀ 时,p ≥ 0.05。
(对另一些检验,如比例检验,常用的检验和区间公式略有不同,在边界附近可能不一致。)
好的做法:始终两者都报告。置信区间显示效应多大、估计多精确;仅凭 p 值做不到。