The Taste Tester & the Election PollsterTaste Tester और Election Pollster尝味师与选举民调员
A cook is preparing a 50-litre pot of dal for a wedding feast of 500 guests. Does she pour out every drop to check the salt? Of course not. She stirs the pot well, takes one ladle — maybe 100 ml — tastes it, adjusts the seasoning, and confidently serves the whole pot.
एक रसोइया शादी की दावत के 500 मेहमानों के लिए 50 लीटर दाल बना रही है। क्या वह नमक जाँचने के लिए हर बूँद निकालती है? बिल्कुल नहीं। वह बर्तन को अच्छी तरह चलाती है, एक कलछा — शायद 100 ml — लेती है, चखती है, मसाला ठीक करती है, और पूरे भरोसे से पूरी दाल परोस देती है।
一位厨师正在为 500 位婚宴宾客准备 50 升豆汤(dal)。她会把每一滴都倒出来尝咸淡吗?当然不会。她先把锅搅匀,舀一勺 —— 大约 100 ml —— 尝一尝,调好味,然后放心地端出整锅。
One ladle, 500 guests. That is inferential statistics in its simplest form — and the stirring matters. Without it, the ladle could taste only the salty top layer.
एक कलछा, 500 मेहमान। यही अपने सबसे आसान रूप में inferential statistics है — और चलाना ज़रूरी है। उसके बिना कलछा सिर्फ़ ऊपर की नमकीन परत चख सकता है।
一勺,五百位宾客。这就是最朴素的推断统计 —— 而且搅匀很关键。不搅匀,那一勺可能只尝到最上面那层咸汤。
India's 2024 general election had about 97 crore (970 million) eligible voters. No pollster asks them all. Exit pollsters interview a sample — from tens of thousands to a few lakh people — and project seats for 543 constituencies. In 2024, several major exit polls projected 350–400 seats for the NDA; the actual result was 293. Experts pointed to possible sampling problems, such as some groups being under-represented. The lesson: inference from a part to the whole is powerful, but only as good as the sample — a big sample does not cure a biased one.
India के 2024 general election में लगभग 97 करोड़ (970 million) मतदाता थे। कोई pollster सबसे नहीं पूछता। Exit pollsters एक sample से बात करते हैं — हज़ारों से लेकर कुछ लाख लोगों तक — और 543 सीटों का अनुमान लगाते हैं। 2024 में कई बड़े exit polls ने NDA को 350–400 सीटें दीं; असली नतीजा 293 था। Experts ने संभावित sampling समस्याओं की ओर इशारा किया, जैसे कुछ groups का कम प्रतिनिधित्व। सबक: हिस्से से पूरे के बारे में inference ताक़तवर है, पर उतना ही अच्छा जितना sample — बड़ा sample, biased sample का इलाज नहीं।
印度 2024 年大选约有 9.7 亿合格选民。没有哪家民调机构会问遍所有人。出口民调只访问一个样本 —— 从几万人到几十万人不等 —— 再推算 543 个选区的席位。2024 年,几家主要出口民调预测全国民主联盟(NDA)获得 350–400 席;实际结果是 293 席。专家指出可能存在抽样问题,比如某些群体代表性不足。教训是:由部分推断整体很强大,但好坏取决于样本 —— 样本再大,也治不好偏差。
Every day, decisions worth crores — drug approvals, crop forecasts, quality checks, credit-risk models — are made not by measuring everyone and everything, but by measuring a few carefully and reasoning about the rest. That is the job of inferential statistics.
हर दिन करोड़ों के फ़ैसले — दवाओं की मंज़ूरी, फ़सल का अनुमान, quality checks, credit-risk models — सबको मापकर नहीं, बल्कि कुछ को ध्यान से मापकर और बाक़ी के बारे में तर्क करके लिए जाते हैं। यही inferential statistics का काम है।
每天,价值巨大的决策 —— 药品审批、作物预测、质量检查、信用风险模型 —— 都不是靠测量所有人和所有东西做出的,而是靠认真测量一小部分,再推断其余。这就是推断统计的任务。
What Is Inferential Statistics?Inferential Statistics क्या है?什么是推断统计?
Statistics has two broad branches. Descriptive statistics summarises the data you already have — means, medians, charts. Inferential statistics goes further: it uses a sample to draw conclusions — inferences — about a larger population you could not fully measure, and it tells you how uncertain those conclusions are.
Statistics की दो बड़ी शाखाएँ हैं। Descriptive statistics आपके पास मौजूद data का सार देता है — means, medians, charts. Inferential statistics आगे जाता है: यह sample से उस बड़ी population के बारे में निष्कर्ष — inferences — निकालता है जिसे आप पूरा नहीं माप सकते, और बताता है कि वे निष्कर्ष कितने अनिश्चित हैं।
统计学有两大分支。描述统计概括你已有的数据 —— 均值、中位数、图表。推断统计更进一步:用样本对无法全部测量的更大总体得出结论(推断),并告诉你这些结论有多不确定。
- Estimate population parametersPopulation parameters का अनुमान估计总体参数
- Confidence intervalsConfidence intervals置信区间
- e.g. mean income in Indiaजैसे India की औसत income例如印度的平均收入
- Test claims about populationsPopulations के बारे में दावों की जाँच检验关于总体的论断
- t-tests, chi-square, ANOVAt-tests, chi-square, ANOVAt 检验、卡方、方差分析
- e.g. does drug A beat drug B?जैसे क्या drug A, drug B से बेहतर है?例如药物 A 是否优于药物 B?
- Generalise patterns to new dataPatterns को नए data पर लागू करना把规律推广到新数据
- Regression, classificationRegression, classification回归、分类
- e.g. predict loan defaultजैसे loan default का अनुमान例如预测贷款违约
(1) The sample must be representative of the population — no hidden bias. (2) Chance must decide who is in the sample (random selection), so probability theory can measure the uncertainty. Break either, and the formulas still produce numbers — but the numbers no longer describe the population.
(1) Sample population का सही प्रतिनिधि होना चाहिए — कोई छिपा bias नहीं। (2) Sample में कौन आएगा, यह संयोग तय करे (random selection), ताकि probability theory अनिश्चितता माप सके। किसी एक को भी तोड़ें, तो formulas अब भी संख्याएँ देंगे — पर वे संख्याएँ population का वर्णन नहीं करेंगी।
(1)样本必须能代表总体 —— 没有隐藏的偏差。(2)由随机决定谁进入样本(随机抽取),这样概率论才能衡量不确定性。破坏任何一条,公式照样能算出数字 —— 但这些数字已不再描述总体。
Inference in Pictures — Understand Before the Mathsतस्वीरों में Inference — गणित से पहले समझें图解推断 — 先理解,再算数
We never see the whole population. We pick a random sample, measure it, and use it to estimate the population — together with a margin of error.
हम पूरी population कभी नहीं देखते। हम एक random sample चुनते हैं, उसे मापते हैं, और उससे population का अनुमान लगाते हैं — margin of error के साथ।
我们永远看不到整个总体。我们随机抽取一个样本,测量它,再用它来估计总体 —— 同时给出误差范围。
Population vs SamplePopulation vs Sample总体 vs 样本
Before you can infer anything, be clear about what you measured (the sample) and what you want to talk about (the population).
कुछ भी infer करने से पहले साफ़ रहें कि आपने क्या मापा (sample) और आप किसके बारे में बात करना चाहते हैं (population)।
在做任何推断之前,先弄清你测量的是什么(样本),想讨论的是什么(总体)。
| ConceptConcept概念 | PopulationPopulation总体 | SampleSample样本 |
|---|---|---|
| Definitionपरिभाषा定义 | Every member of the group of interestरुचि के group का हर सदस्य所关心群体的每一个成员 | A subset drawn from the populationPopulation से लिया गया हिस्सा从总体中抽取的子集 |
| Sizeआकार规模 | N | n |
| Numbers are calledसंख्याओं का नाम数值称为 | Parameters (μ, σ, P)Parameters (μ, σ, P)参数(μ、σ、P) | Statistics (x̄, s, p̂)Statistics (x̄, s, p̂)统计量(x̄、s、p̂) |
| Usually known?आम तौर पर ज्ञात?通常已知? | Rarelyशायद ही很少 | Yes — calculatedहाँ — निकाले जाते हैं是 —— 计算得出 |
| Roleभूमिका作用 | What we want to knowजो हम जानना चाहते हैं我们想知道的 | The tool we use to find itजिससे हम उसे खोजते हैं用来找到它的工具 |
| Example (medicine)उदाहरण (medicine)例子(医学) | All diabetic patients in IndiaIndia के सभी diabetic patients印度所有糖尿病患者 | 500 patients in a clinical trialClinical trial के 500 patients临床试验中的 500 名患者 |
Sampling Techniques — How to Pick a SampleSampling Techniques — Sample कैसे चुनें抽样方法 — 如何选样本
Choosing who goes into your sample is one of the most important decisions in any study. The wrong method creates sampling bias — a systematic error that no amount of clever statistics can fix later.
Sample में कौन आएगा, यह किसी भी study के सबसे ज़रूरी फ़ैसलों में से एक है। ग़लत तरीका sampling bias बनाता है — एक व्यवस्थित ग़लती जिसे बाद में कोई होशियार statistics ठीक नहीं कर सकती।
决定谁进入样本,是任何研究中最重要的决定之一。方法不对就会产生抽样偏差 —— 一种系统性误差,之后再巧妙的统计方法也无法修正。
1. Simple random sampling1. Simple random sampling1. 简单随机抽样
Every member has the same chance of being chosen, like a lottery. In Python: df.sample(n=100). The cleanest method, but it needs a complete list of the population, and by bad luck it can under-represent small groups.
हर सदस्य के चुने जाने का chance बराबर है, lottery की तरह। Python में: df.sample(n=100). सबसे साफ़ तरीका, पर इसके लिए population की पूरी list चाहिए, और बदक़िस्मती से छोटे groups कम आ सकते हैं।
每个成员被选中的机会相同,就像抽奖。Python 中:df.sample(n=100)。最干净的方法,但需要完整的总体名单,而且可能因运气不好而让小群体代表不足。
2. Stratified sampling2. Stratified sampling2. 分层抽样
Split the population into non-overlapping groups (strata) — rural / urban / metro, age groups, states — and draw a random sample inside each one. Every group is guaranteed its fair share, and when the groups differ a lot, estimates become more precise. India's national household surveys use stratified designs for this reason.
Population को बिना overlap वाले groups (strata) में बाँटें — rural / urban / metro, age groups, राज्य — और हर group के अंदर random sample लें। हर group को उसका सही हिस्सा पक्का मिलता है, और जब groups बहुत अलग हों तो अनुमान ज़्यादा सटीक होते हैं। India के national household surveys इसी वजह से stratified design इस्तेमाल करते हैं।
把总体分成互不重叠的组(层) —— 农村 / 城镇 / 大都市、年龄段、各邦 —— 在每一层内部随机抽样。每组都保证得到应有的份额;当各组差异很大时,估计会更精确。印度的全国住户调查正因如此采用分层设计。
3. Cluster sampling3. Cluster sampling3. 整群抽样
Split the population into natural clusters (villages, schools, city blocks), randomly pick some clusters, and survey everyone in them. Much cheaper in the field — 50 villages instead of 5,000 scattered homes. The catch: people in one cluster tend to be similar, so the estimate is less precise than a simple random sample of the same size.
Population को प्राकृतिक clusters (गाँव, schools, city blocks) में बाँटें, कुछ clusters random चुनें, और उनमें सबका survey करें। Field में बहुत सस्ता — बिखरे 5,000 घरों की जगह 50 गाँव। दिक़्क़त: एक cluster के लोग मिलते-जुलते होते हैं, इसलिए अनुमान उतने ही बड़े simple random sample से कम सटीक होता है।
把总体分成自然的群(村庄、学校、街区),随机选出若干群,调查其中的每一个人。实地调查便宜得多 —— 跑 50 个村,而不是 5,000 户分散的人家。缺点是同一群里的人往往相似,所以估计不如同样大小的简单随机样本精确。
4. Systematic sampling4. Systematic sampling4. 系统抽样
Pick a random start, then every k-th item on a list, where k = N / n. To pick 200 patients from a register of 4,000: k = 20, start at a random number from 1 to 20, then take every 20th. Simple and usually as good as random — unless the list has a repeating pattern that lines up with k (for example, every 20th entry is always a Monday-morning emergency).
एक random शुरुआत चुनें, फिर list का हर k-वाँ item, जहाँ k = N / n. 4,000 के register से 200 patients चुनने के लिए: k = 20, 1 से 20 के बीच random संख्या से शुरू करें, फिर हर 20वाँ लें। आसान और आम तौर पर random जितना अच्छा — जब तक list में k से मेल खाता कोई दोहराव वाला pattern न हो (जैसे हर 20वीं entry हमेशा सोमवार सुबह की emergency हो)।
随机选一个起点,然后在名单上每隔 k 个取一个,k = N / n。要从 4,000 人的登记册中选 200 名患者:k = 20,从 1 到 20 之间随机选起点,然后每隔 20 人取一人。简单,通常和随机抽样一样好 —— 除非名单存在与 k 对齐的周期规律(例如每第 20 条总是周一早上的急诊)。
5. Convenience sampling5. Convenience sampling5. 方便抽样
Ask whoever is easiest to reach — your classmates, your social-media followers, shoppers at the nearest mall. Fast and cheap, but almost always biased, and no formula can tell you how biased. Use it only for early pilots or to collect ideas, never for numbers about a wider population.
जो सबसे आसानी से मिले, उससे पूछें — आपके classmates, social media followers, पास के mall के खरीदार। तेज़ और सस्ता, पर लगभग हमेशा biased, और कोई formula नहीं बता सकता कि कितना। इसे सिर्फ़ शुरुआती pilots या ideas जुटाने के लिए इस्तेमाल करें, बड़ी population के बारे में संख्याओं के लिए कभी नहीं।
找最容易接触到的人 —— 同学、社交媒体粉丝、附近商场的顾客。又快又便宜,但几乎总是有偏差,而且没有公式能告诉你偏差有多大。只能用于早期试点或收集想法,绝不能用来得出关于更大总体的数字。
In proportional allocation, each stratum's sample matches its share of the population (60% rural → 60 of every 100). In equal allocation, every stratum gets the same sample size — useful when you need to compare small groups. With equal allocation you must weight the results back to the population shares before computing an overall average.
Proportional allocation में हर stratum का sample उसके population हिस्से जितना होता है (60% rural → हर 100 में 60)। Equal allocation में हर stratum को बराबर sample मिलता है — छोटे groups की तुलना के लिए उपयोगी। Equal allocation में कुल औसत निकालने से पहले नतीजों को population के हिस्सों के हिसाब से weight करना ज़रूरी है।
按比例分配时,每层样本数与其在总体中的占比一致(60% 农村 → 每 100 人中 60 人)。等量分配时,每层样本数相同 —— 适合比较规模很小的群体。采用等量分配时,计算总体平均前必须按总体占比对结果加权。
360 people: rural (green), urban (blue) and metro (purple); bigger dots earn more. Pick a method to draw a sample, then press "Repeat 100 times" to see where its estimates land compared with the true mean.
360 लोग: rural (हरा), urban (नीला) और metro (बैंगनी); बड़े dots ज़्यादा कमाते हैं। Sample निकालने के लिए एक तरीका चुनें, फिर "100 बार दोहराएँ" दबाएँ और देखें कि उसके अनुमान असली mean के मुक़ाबले कहाँ गिरते हैं।
360 个人:农村(绿)、城镇(蓝)、大都市(紫);点越大收入越高。选一种方法抽样,再点“重复 100 次”,看它的估计值相对真实均值落在哪里。
| TechniqueTechnique方法 | Probability-based?Probability-based?概率抽样? | CostCost成本 | Main riskमुख्य जोखिम主要风险 | Best forसबसे अच्छा最适合 |
|---|---|---|---|---|
| Simple randomSimple random简单随机 | Yesहाँ是 | Mediumमध्यम中 | Low (needs a full list)कम (पूरी list चाहिए)低(需完整名单) | When a full list existsजब पूरी list हो有完整名单时 |
| StratifiedStratified分层 | Yesहाँ是 | Higherज़्यादा较高 | Low — and more preciseकम — और ज़्यादा सटीक低 —— 且更精确 | Populations with very different groupsबहुत अलग groups वाली populations各组差异很大的总体 |
| ClusterCluster整群 | Yesहाँ是 | Lowकम低 | Less precise per personप्रति व्यक्ति कम सटीक每人精度较低 | Spread-out populationsफैली हुई populations地域分散的总体 |
| SystematicSystematic系统 | Yesहाँ是 | Lowकम低 | Hidden patterns in the listList में छिपे patterns名单中隐藏的周期规律 | Ordered lists, production linesक्रमबद्ध lists, production lines有序名单、生产线 |
| ConvenienceConvenience方便 | Noनहीं否 | Very lowबहुत कम很低 | High, unknown biasऊँचा, अज्ञात bias偏差大且未知 | Pilots and ideas onlyसिर्फ़ pilots और ideas仅限试点和收集想法 |
Sampling techniques in PythonPython में sampling techniques用 Python 实现抽样方法
import pandas as pd
import numpy as np
rng = np.random.default_rng(42)
N = 10_000
# Simulated population: 10,000 workers. Income depends on region.
region = rng.choice(['Rural', 'Urban', 'Metro'], size=N, p=[0.60, 0.30, 0.10])
base = {'Rural': 9.9, 'Urban': 10.5, 'Metro': 11.1} # log-income centres
income = np.exp([base[r] + rng.normal(0, 0.5) for r in region])
population = pd.DataFrame({'worker_id': range(1, N + 1), 'region': region, 'income': income})
print(f"Population size N = {N:,}")
print(f"TRUE population mean income: ₹{population['income'].mean():,.0f}")
print(population.groupby('region')['income'].mean().round(0))
# ── 1. Simple random sampling ──
srs = population.sample(n=200, random_state=1)
print(f"Simple random (n=200): ₹{srs['income'].mean():,.0f}")
# ── 2. Stratified sampling (proportional: 60 / 30 / 10 %) ──
sizes = {'Rural': 120, 'Urban': 60, 'Metro': 20}
stratified = pd.concat([population[population['region'] == r].sample(n=k, random_state=1)
for r, k in sizes.items()])
print(f"Stratified (n=200): ₹{stratified['income'].mean():,.0f}")
# ── 3. Systematic sampling ──
k = N // 200 # sampling interval = 50
start = np.random.default_rng(1).integers(0, k) # random start 0..49
systematic = population.iloc[start::k]
print(f"Systematic (n={len(systematic)}): ₹{systematic['income'].mean():,.0f} (k = {k}, start = {start})")
One sample from each method lands near the true mean of ₹33,623. To compare methods fairly, repeat each one many times:
हर तरीके का एक sample असली mean ₹33,623 के पास आता है। तरीकों की सही तुलना के लिए हर एक को कई बार दोहराएँ:
每种方法的一个样本都落在真实均值 ₹33,623 附近。要公平比较,需要把每种方法重复很多次:
# Repeat each method 2,000 times: which one lands closer to the truth?
true_mean = population['income'].mean()
groups = {r: g['income'].to_numpy() for r, g in population.groupby('region')}
all_inc = population['income'].to_numpy()
rng2 = np.random.default_rng(7)
srs_means, strat_means = [], []
for _ in range(2000):
srs_means.append(rng2.choice(all_inc, 200, replace=False).mean())
parts = [rng2.choice(groups[r], k, replace=False) for r, k in sizes.items()]
strat_means.append(np.concatenate(parts).mean())
for name, m in [("Simple random", srs_means), ("Stratified", strat_means)]:
m = np.array(m)
print(f"{name:<14} average of estimates ₹{m.mean():,.0f} typical error (SE) ₹{m.std():,.0f}")
Both methods are right on average, but stratified sampling misses by about ₹1,457 typically instead of ₹1,876 — a 22% smaller error for the same 200 people, because incomes differ so much between regions.
दोनों तरीके औसतन सही हैं, पर stratified sampling आम तौर पर ₹1,876 की जगह लगभग ₹1,457 से चूकता है — उन्हीं 200 लोगों के लिए 22% कम ग़लती, क्योंकि regions के बीच income बहुत अलग है।
两种方法平均而言都准确,但分层抽样的典型误差约为 ₹1,457,而不是 ₹1,876 —— 同样 200 人,误差小 22%,因为各地区收入差异很大。
# Convenience sample: survey only the easy-to-reach Metro and Urban workers
easy = population[population['region'] != 'Rural']['income'].to_numpy()
rng3 = np.random.default_rng(3)
big_biased = rng3.choice(easy, 2000, replace=False).mean()
small_random = rng3.choice(all_inc, 100, replace=False).mean()
print(f"TRUE mean: ₹{true_mean:,.0f}")
print(f"Convenience sample, n = 2,000: ₹{big_biased:,.0f} (error {big_biased / true_mean - 1:+.0%})")
print(f"Simple random sample, n = 100: ₹{small_random:,.0f} (error {small_random / true_mean - 1:+.0%})")
A convenience sample of 2,000 people missed by +49%. A random sample of just 100 missed by 4%. More data shrinks random error, but it repeats a bias perfectly. In 1936 the Literary Digest magazine received about 2.4 million poll replies and predicted Landon would beat Roosevelt; its lists came from car and telephone owners and its own readers — wealthier than average — and only the people who chose to reply were counted. Roosevelt won in a landslide. George Gallup, with a much smaller but better-chosen sample, got it right.
2,000 लोगों का convenience sample +49% से चूका। सिर्फ़ 100 का random sample 4% से। ज़्यादा data random ग़लती घटाता है, पर bias को हूबहू दोहराता है। 1936 में Literary Digest magazine को लगभग 24 लाख poll जवाब मिले और उसने कहा कि Landon, Roosevelt को हराएँगे; उसकी lists car और telephone मालिकों और अपने पाठकों से आई थीं — औसत से अमीर — और सिर्फ़ जवाब देने वाले गिने गए। Roosevelt भारी बहुमत से जीते। George Gallup ने बहुत छोटे पर बेहतर चुने sample से सही अनुमान लगाया।
2,000 人的方便样本误差达 +49%;仅 100 人的随机样本误差只有 4%。更多数据能缩小随机误差,却会原封不动地重复偏差。1936 年,《文学文摘》杂志收到约 240 万份民调回复,预测兰登将击败罗斯福;它的名单来自汽车和电话拥有者以及自家读者 —— 比平均水平更富裕 —— 而且只统计了主动回信的人。结果罗斯福压倒性胜出。乔治·盖洛普用小得多但选得更好的样本,预测正确。
The Sampling Distribution — the Heart of InferenceSampling Distribution — Inference का दिल抽样分布 — 推断的核心
Suppose you want the average monthly salary of all workers in India. You take a random sample of 100 workers and get x̄ = ₹32,500. Another researcher's random sample of 100 gives ₹31,800; a third gives ₹33,100. Every possible sample has its own x̄. The distribution of all these sample means is the sampling distribution of the mean. It tells you how far one sample mean is likely to be from the truth.
मान लें आप India के सभी workers की औसत monthly salary जानना चाहते हैं। आप 100 workers का random sample लेते हैं और x̄ = ₹32,500 पाते हैं। दूसरे researcher का 100 का random sample ₹31,800 देता है; तीसरे का ₹33,100. हर संभव sample का अपना x̄ है। इन सभी sample means का distribution ही sampling distribution of the mean है। यह बताता है कि एक sample mean सच से कितनी दूर हो सकता है।
假设你想知道印度所有劳动者的平均月薪。你随机抽取 100 人,得到 x̄ = ₹32,500。另一位研究者随机抽取的 100 人得到 ₹31,800;第三位得到 ₹33,100。每一个可能的样本都有自己的 x̄。所有这些样本均值的分布,就是均值的抽样分布。它告诉你一个样本均值可能离真相有多远。
Picture a giant jar of marbles, each labelled with one worker's salary. Close your eyes, pull out 100, average them, put them back, and repeat thousands of times. Plot all those averages: they pile up around the true mean, and for a reasonably large n they form a bell shape — even if the salaries themselves are very skewed. That is the Central Limit Theorem at work.
Marbles के एक बड़े jar की कल्पना करें, हर marble पर एक worker की salary लिखी है। आँखें बंद करके 100 निकालें, उनका औसत लें, वापस रखें, और हज़ारों बार दोहराएँ। सारे औसत plot करें: वे असली mean के आसपास जमा होते हैं, और ठीक-ठाक बड़े n पर bell का आकार ले लेते हैं — भले ही salaries ख़ुद बहुत skewed हों। यही Central Limit Theorem है।
想象一个装满弹珠的大罐子,每颗弹珠上写着一位劳动者的工资。闭上眼睛摸出 100 颗,求平均,放回去,再重复几千次。把这些平均值画出来:它们聚集在真实均值周围,只要 n 足够大,就会形成钟形 —— 即使工资本身非常偏斜。这就是中心极限定理在起作用。
Standard deviation (s) describes how much individual values vary — the spread of the data. It does not shrink with more data.
Standard error (SE) describes how much the sample mean would vary from sample to sample — the precision of your estimate. It shrinks as n grows.
Mixing them up (for example, error bars showing SE when readers expect SD) is one of the most common mistakes in reports and papers.
Standard deviation (s) बताता है कि अलग-अलग values कितना बदलती हैं — data का फैलाव। ज़्यादा data से यह नहीं घटता।
Standard error (SE) बताता है कि sample mean एक sample से दूसरे में कितना बदलेगा — अनुमान की precision. n बढ़ने पर यह घटता है।
दोनों को मिला देना (जैसे error bars में SE दिखाना जबकि पाठक SD समझें) reports और papers की सबसे आम ग़लतियों में से एक है।
标准差(s)描述单个数值的波动 —— 数据的离散程度。数据再多它也不会变小。
标准误(SE)描述样本均值在不同样本之间的波动 —— 估计的精度。随着 n 增大而变小。
把两者混淆(例如误差线画的是 SE,而读者以为是 SD)是报告和论文中最常见的错误之一。
Choose a population (even a strange one), choose n, and draw samples. The purple histogram collects the sample means; the red dashed curve is the normal shape the CLT predicts.
एक population चुनें (अजीब वाली भी), n चुनें, और samples निकालें। बैंगनी histogram sample means जमा करता है; लाल dashed curve वह normal आकार है जिसकी CLT भविष्यवाणी करता है।
选一个总体(再奇怪的也行),选 n,然后抽样。紫色直方图收集样本均值;红色虚线是中心极限定理预测的正态形状。
The Central Limit Theorem in ActionCentral Limit Theorem का असर中心极限定理实战
The CLT says: whatever the shape of the population (as long as its variance is finite), the sampling distribution of the mean gets closer and closer to normal as n grows. "n ≥ 30" is a popular rule of thumb, but how fast it happens depends on how skewed the population is.
CLT कहता है: population का आकार कुछ भी हो (बस उसका variance सीमित हो), n बढ़ने पर mean का sampling distribution normal के और पास आता जाता है। "n ≥ 30" एक लोकप्रिय अंगूठा-नियम है, पर यह कितनी जल्दी होता है, यह population के skew पर निर्भर है।
中心极限定理说:无论总体是什么形状(只要方差有限),随着 n 增大,均值的抽样分布会越来越接近正态。“n ≥ 30”是流行的经验法则,但收敛多快取决于总体有多偏斜。
import numpy as np
from scipy import stats
rng = np.random.default_rng(0)
population_data = rng.exponential(scale=5, size=100_000) # heavily right-skewed
sigma = population_data.std()
print(f"Population mean {population_data.mean():.3f}, SD {sigma:.3f}, skewness {stats.skew(population_data):.2f}")
for n in [2, 10, 30, 100]:
means = np.array([rng.choice(population_data, size=n, replace=False).mean() for _ in range(10_000)])
print(f"n = {n:>3} | mean of x̄ = {means.mean():.3f} | SE theory = {sigma / np.sqrt(n):.3f} "
f"| SE observed = {means.std():.3f} | skewness of x̄ = {stats.skew(means):.2f}")
The simulation confirms the theory: the mean of x̄ stays at 5, the observed SE matches σ/√n, and the skewness of the sample means falls from 1.34 to 0.18 — close to the theoretical 2/√n.
Simulation theory को पक्का करता है: x̄ का mean 5 पर रहता है, observed SE, σ/√n से मेल खाता है, और sample means की skewness 1.34 से गिरकर 0.18 हो जाती है — theory के 2/√n के पास।
模拟验证了理论:x̄ 的均值保持在 5,观测到的 SE 与 σ/√n 吻合,样本均值的偏度从 1.34 降到 0.18 —— 接近理论值 2/√n。
Because the sampling distribution of x̄ is approximately normal for large enough n, we can use normal-curve tools — z-scores, probabilities, confidence intervals — to make statements about μ without knowing the shape of the population. This is why z-tests, t-tests and confidence intervals for means work so widely.
क्योंकि काफ़ी बड़े n पर x̄ का sampling distribution लगभग normal होता है, हम normal-curve के tools — z-scores, probabilities, confidence intervals — से μ के बारे में बात कर सकते हैं, population का आकार जाने बिना। इसीलिए means के z-tests, t-tests और confidence intervals इतने व्यापक रूप से काम करते हैं।
由于 n 足够大时 x̄ 的抽样分布近似正态,我们就能用正态曲线的工具 —— z 分数、概率、置信区间 —— 来推断 μ,而无需知道总体的形状。这正是均值的 z 检验、t 检验和置信区间能广泛适用的原因。
From Sample to Estimate — Standard Error and Confidence IntervalsSample से अनुमान तक — Standard Error और Confidence Intervals从样本到估计 — 标准误与置信区间
import numpy as np
from scipy import stats
rng = np.random.default_rng(2)
sample = rng.lognormal(mean=10.5, sigma=0.5, size=100) # monthly income of 100 workers (₹)
x_bar = sample.mean()
s = sample.std(ddof=1)
n = len(sample)
se = s / np.sqrt(n) # standard error
ci = stats.t.interval(0.95, df=n - 1, loc=x_bar, scale=se) # t because σ is unknown
print(f"Sample mean x̄: ₹{x_bar:,.0f}")
print(f"Standard deviation s: ₹{s:,.0f}")
print(f"Standard error SE: ₹{se:,.0f}")
print(f"95% CI: ₹{ci[0]:,.0f} to ₹{ci[1]:,.0f}")
print(f"True mean of this population: ₹{np.exp(10.5 + 0.5**2 / 2):,.0f}")
We use the t-distribution because σ is unknown and estimated by s; for large n the t and normal answers are almost the same. Here the interval ₹36,474 – ₹44,462 does contain the true mean of ₹41,151.
हम t-distribution इस्तेमाल करते हैं क्योंकि σ अज्ञात है और s से अनुमानित है; बड़े n पर t और normal के जवाब लगभग एक जैसे हैं। यहाँ interval ₹36,474 – ₹44,462 असली mean ₹41,151 को शामिल करता है।
使用 t 分布是因为 σ 未知、只能用 s 估计;n 较大时 t 与正态的结果几乎相同。这里区间 ₹36,474 – ₹44,462 确实包含了真实均值 ₹41,151。
The 95% describes the method, not one interval. If you repeated the survey many times and built an interval each time, about 95% of those intervals would contain the true mean — and about 5% would miss it. For any single interval, you do not know whether it is one of the lucky 95%. The simulation below shows this directly.
95% तरीके के बारे में है, किसी एक interval के बारे में नहीं। अगर आप survey कई बार दोहराएँ और हर बार interval बनाएँ, तो उनमें से लगभग 95% असली mean को शामिल करेंगे — और लगभग 5% चूकेंगे। किसी एक interval के बारे में आप नहीं जानते कि वह भाग्यशाली 95% में है या नहीं। नीचे का simulation यह सीधे दिखाता है।
95% 描述的是方法,而不是某一个区间。如果你把调查重复很多次、每次都构造一个区间,大约 95% 的区间会包含真实均值 —— 约 5% 会漏掉。对任何一个具体区间,你都不知道它是否属于幸运的 95%。下面的模拟直接展示了这一点。
import numpy as np
from scipy import stats
# What does "95% confidence" mean? Repeat the whole survey 10,000 times.
rng = np.random.default_rng(11)
true_mu = np.exp(10.5 + 0.5**2 / 2)
hits = 0
for _ in range(10_000):
x = rng.lognormal(10.5, 0.5, 100)
lo, hi = stats.t.interval(0.95, df=99, loc=x.mean(), scale=x.std(ddof=1) / 10)
hits += lo <= true_mu <= hi
print(f"Intervals that contained the true mean: {hits / 100:.1f}%")
Each line is a confidence interval from a new random sample. Blue lines catch the true mean μ = 50; red lines miss it. Change n and the confidence level.
हर line एक नए random sample का confidence interval है। नीली lines असली mean μ = 50 को पकड़ती हैं; लाल lines चूकती हैं। n और confidence level बदलें।
每条线是一个新随机样本的置信区间。蓝线包含真实均值 μ = 50;红线没有。调整 n 和置信水平。
rng.choice(data, size=n, replace=False) samples without replacement — like drawing names from a hat and not putting them back. That is how real surveys work. replace=True is used in bootstrapping, where you resample your own sample (with replacement) many times to estimate uncertainty when no formula is available. Do not mix them up.
rng.choice(data, size=n, replace=False) without replacement sample लेता है — जैसे टोपी से नाम निकालकर वापस न रखना। असली surveys ऐसे ही चलते हैं। replace=True bootstrapping में इस्तेमाल होता है, जहाँ कोई formula न होने पर अनिश्चितता का अनुमान लगाने के लिए अपने ही sample से (replacement के साथ) कई बार resample करते हैं। दोनों को न मिलाएँ।
rng.choice(data, size=n, replace=False) 是不放回抽样 —— 就像从帽子里抽名字、抽出后不放回。真实调查就是这样。replace=True 用于自助法(bootstrap):在没有公式可用时,对自己的样本(有放回地)反复重抽,以估计不确定性。两者不要混淆。
Key Concepts — Comparison Tableमुख्य Concepts — तुलना Table核心概念 — 对照表
| ConceptConcept概念 | SymbolSymbol符号 | Belongs toकिसका属于 | Known?ज्ञात?已知? | Purposeउद्देश्य用途 |
|---|---|---|---|---|
| Population meanPopulation mean总体均值 | μ | PopulationPopulation总体 | Usually noआम तौर पर नहीं通常未知 | The true average we wantअसली औसत जो हमें चाहिए我们想知道的真实平均 |
| Sample meanSample mean样本均值 | x̄ | SampleSample样本 | Yesहाँ已知 | Estimates μμ का अनुमान估计 μ |
| Population SDPopulation SD总体标准差 | σ | PopulationPopulation总体 | Usually noआम तौर पर नहीं通常未知 | True spreadअसली फैलाव真实离散程度 |
| Sample SDSample SD样本标准差 | s | SampleSample样本 | Yesहाँ已知 | Estimates σ (ddof = 1)σ का अनुमान (ddof = 1)估计 σ(ddof = 1) |
| Standard errorStandard error标准误 | σ/√n ≈ s/√n | Sampling distributionSampling distribution抽样分布 | Estimatedअनुमानित估计得出 | Precision of x̄x̄ की precisionx̄ 的精度 |
| Sampling distributionSampling distribution抽样分布 | x̄ ≈ N(μ, SE²) | TheoryTheory理论 | Approximate (CLT)लगभग (CLT)近似(CLT) | Basis for intervals and testsIntervals और tests का आधार区间与检验的基础 |