1.3.20 · HinglishProbability & Statistics

Hypothesis testing and p-values

2,433 words11 min readRead in English

1.3.20 · AI-ML › Probability & Statistics


Hypothesis Testing Kya Hai?

Hypothesis testing ek statistical framework hai jo sample data use karke kisi population ke baare mein do competing claims mein se ek decide karta hai.

Process (first principles se):

  1. Maano sach hai (jab tak prove na ho, innocent maano).
  2. Apne data se ek test statistic compute karo—ek number jo summarize kare ki tera observation ki prediction se kitna door hai.
  3. p-value calculate karo: .
  4. Decision rule: Agar (significance level, aksar 0.05), toh reject karo. Warna, reject karne mein fail ho jao.

p-value Derive Karna (Coin Example)

Setup: Tum ek coin baar flip karte ho, observe karte ho heads. Test karo vs .

Step 1: Test Statistic Choose Karo

ke under, . Bade ke liye, normal approximation use karo:

Kyun? CLT kehta hai sample proportions approximately normal hote hain. measure karta hai "mean se kitne standard deviations door."

Derivation:

  • Mean:
  • Std dev:
  • Observed:

Step 2: p-value Compute Karo

Kyunki two-tailed hai (hum bias ki kisi bhi direction mein care karte hain), p-value hai:

2 kyun? Hum dono tails count karte hain: (bahut zyada heads) aur (bahut zyada tails).

Standard normal table se:

Step 3: Decision

reject karo. Conclusion: Strong evidence hai ki coin biased hai.

p-value ka matlab: Agar coin fair hota, toh sirf 0.26% chance hota ki hum itna extreme result dekhte (ya aur zyada extreme). Yeh itna rare hai ki "fair coin" assumption par doubt hota hai.


Formula Reference


Worked Examples



Common Mistakes




The Significance Level

kya hai? Significance level woh threshold hai jiske liye "itna weird ki reject kar do." Aam tor par 0.05, lekin yeh arbitrary hai.

0.05 kahan se aaya? Historical convention (R.A. Fisher, 1920s). Yeh do errors ke beech balance karta hai:

  • Type I error (): ko reject karna jab yeh sach ho (false positive)
  • Type II error (): ko reject karne mein fail hona jab yeh galat ho (false negative)

Trade-off: Chhota → kam false positives, lekin zyada false negatives (less power).


Active Recall Practice

Recall Feynman Explanation (Ek 12-saal ke bachche ko samjhao)

Theek hai, socho tumhara dost kehta hai, "Mere paas ek magic coin hai jo hamesha heads pe aata hai!" Tum skeptical ho, toh tum kehte ho, "Prove karo." Woh use 10 baar flip karta hai, aur yeh 7 baar heads pe aata hai.

Ab, sawaal yeh hai: Kya coin sach mein magic hai, ya unhone bas luck paaya?

Hypothesis testing detective banne jaisa hai. Tum shuru karte ho yeh maanke ki coin normal hai ("null hypothesis"). Phir tum poochho, "Agar coin normal hota, toh kitni baar main 10 mein se 7 ya zyada heads dekhta?" Tum chance calculate karte ho—pata chalta hai yeh kareeban 17% hai (roughly 6 mein se 1 baar). Yahi p-value hai. Kya 17% itna rare hai ki kaho ki coin magic hai? Zyaadatar scientists kehte hain tumhe convince hone ke liye 5% se kam (really rare) chahiye. Toh is case mein, tum kehte, "Nah, 10 mein se 7 aasaani se sirf luck ho sakta hai. Mujhe aur flips dikhao!"

P-value tumhare data ke liye ek "weirdness score" jaisa hai. Jitna chhota hoga, utna zyada tum boring explanation par doubt karte ho aur believe karne lagte ho ki kuch special ho raha hai.



Connections

  • 1.3.1-Random-variables-and-distributions – Test statistics known distributions follow karte hain (normal, chi-squared, t)
  • 1.3.15-Central-limit-theorem – Kyun hum test statistics ke liye normal approximations use kar sakte hain
  • 1.3.18-Confidence-intervals – Hypothesis testing ka dual: agar 95% CI ke bahar hai, toh par reject karo
  • 1.3.21-Type-I-and-Type-II-errors – Hypothesis tests se control hone wale error rates
  • 2.5.7-Statistical-significance-in-experiments – ML systems mein A/B tests par hypothesis testing apply karna
  • 3.2.12-Multiple-testing-correction – Jab bahut saari hypotheses test karein, inflated false positives ke liye adjust karo (Bonferroni, FDR)

#flashcards/ai-ml

P-value kya hota hai? :: Yeh probability hai ki hum apna observed data utna hi extreme ya aur zyada extreme data observe karein, yeh maante hue ki null hypothesis sach hai. Yeh measure karta hai ki humara data ke under kitna "unusual" hai.

" par statistically significant" ka kya matlab hai?
P-value 0.05 se kam hai, toh hum null hypothesis reject karte hain. ke under, itna extreme data 5% se kam time hoga.
Null hypothesis kya hota hai?
Default "koi effect nahi" assumption jise hum test karte hain. Hum maante hain yeh sach hai jab tak data isko reject karne ka strong evidence na de. Example: "Coin fair hai," "Dono groups ke means equal hain."
Alternative hypothesis kya hota hai?
Woh claim jiske liye hum evidence chahte hain, kehta hai ki effect ya difference IS hai. Example: "Coin biased hai," "Treatment group ka mean control se zyada hai."
" reject karne mein fail hona" ka kya matlab hai?
P-value hai, toh hamare paas null ko reject karne ka itna strong evidence nahi hai. Iska matlab yeh NAHI ki sach hai—sirf itna ki data uske saath consistent hai.
Two-tailed test mein p-value compute karte waqt hum 2 se kyun multiply karte hain?
Kyunki hum dono directions mein deviations ki care karte hain (bahut zyada ya bahut kam). Hum dono tails mein extreme hone ki probability count karte hain.
Hypothesis testing mein test statistic kya hota hai?
Ek number jo data se compute hota hai aur summarize karta hai ki observation ki prediction se kitna door hai. Example: z-score .
Type I aur Type II errors mein kya difference hai?
Type I (false positive): ko reject karna jab yeh sach ho, probability = . Type II (false negative): ko reject karne mein fail hona jab yeh galat ho, probability = .
One-tailed vs two-tailed test kab use karte hain?
One-tailed: Jab sirf ek direction mein deviations ki care ho (jaise "naya model better hai"). Two-tailed: Jab kisi bhi difference ki care ho (jaise "naya model different hai").
Significance level kya hota hai?
reject karne ka threshold. Agar toh reject karo. Common choice: 0.05, matlab hum 5% false positive rate tolerate karte hain.
"p < 0.05 matlab galat hai" yeh wrong interpretation kyun hai?
P-value hai , nahi. Yeh ke under data ki extremeness measure karta hai, na ki probability ki galat hai.
Confidence intervals aur hypothesis tests mein kya relationship hai?
Agar koi value ke 95% confidence interval ke bahar hai, toh tum par reject karte. Yeh dono dual methods hain.

Concept Map

assumes true

seeks evidence for

computes

justifies normal approx

standardizes distance from H0

prob of extreme data given H0

threshold

if p less than alpha

Null hypothesis H0

Alternative hypothesis H1

Hypothesis testing

Test statistic Z

Central Limit Theorem

p-value

Significance level alpha

Reject or fail to reject H0