Python में Hypothesis Testing
James Chapman
Curriculum Manager, DataCamp
age_first_code_cut बताता है कि Stack Overflow यूज़र ने पहली बार प्रोग्रामिंग कब शुरू की"adult" मतलब 14 या उससे अधिक उम्र में शुरू किया"child" मतलब 14 से पहले शुरू कियाएक hypothesis किसी अज्ञात population पैरामीटर के बारे में कथन है
hypothesis test दो प्रतिस्पर्धी परिकल्पनाओं की जाँच है
null hypothesis ($H_{0}$) मौजूदा धारणा है
alternative hypothesis ($H_{A}$) शोधकर्ता का नया "चैलेंजर" विचार है
हमारी समस्या के लिए:
Significance level परिकल्पना परीक्षण में "उचित संदेह से परे" की सीमा है

Hypothesis tests जाँचते हैं कि sample statistics null distribution के टेल्स में पड़ते हैं या नहीं
| Test | Tails |
|---|---|
| alternative different from null | two-tailed |
| alternative greater than null | right-tailed |
| alternative less than null | left-tailed |
$H_{A}$: बचपन में प्रोग्रामिंग शुरू करने वाले डेटा साइंटिस्ट्स का अनुपात 35% से अधिक है
यह right-tailed परीक्षण है

p-values: null hypothesis सत्य मानते हुए किसी परिणाम के मिलने की probability
prop_child_samp = (stack_overflow['age_first_code_cut'] == "child").mean()
0.39141972578505085
prop_child_hyp = 0.35
std_error = np.std(first_code_boot_distn, ddof=1)
0.010351057228878566
z_score = (prop_child_samp - prop_child_hyp) / std_error
4.001497129152506
norm.cdf() scipy.stats की normal CDF है.norm.cdf() उपयोग करें.1 - norm.cdf() उपयोग करें.
from scipy.stats import norm
1 - norm.cdf(z_score, loc=0, scale=1)
3.1471479512323874e-05
Python में Hypothesis Testing