R में Hypothesis Testing
Richie Cotton
Data Evangelist at DataCamp
age_first_code_cut बताता है कि Stack Overflow यूज़र ने पहली बार प्रोग्रामिंग कब शुरू की"adult" मतलब 14 या उससे अधिक उम्र में शुरू किया"child" मतलब 14 से पहले शुरू कियाएक hypothesis किसी अज्ञात जनसंख्या पैरामीटर के बारे में कथन है.
hypothesis test दो प्रतिस्पर्धी हाइपोथीसिस का परीक्षण है.
null hypothesis ($H_{0}$) मौजूदा "चैंपियन" विचार है.
alternative hypothesis ($H_{A}$) शोधकर्ता का नया "चैलेंजर" विचार है.
हमारी समस्या के लिए
Significance level हाइपोथीसिस टेस्टिंग के लिए "संदेह से परे" की दहलीज है.

Hypothesis tests जाँचते हैं कि sample statistics null distribution की टेल्स में हैं या नहीं.
| टेस्ट | टेल्स |
|---|---|
| alternative null से अलग | two-tailed |
| alternative null से बड़ा | right-tailed |
| alternative null से छोटा | left-tailed |
$H_{A}$: बचपन में प्रोग्रामिंग शुरू करने वाले डेटा साइंटिस्ट्स का अनुपात 35% से अधिक है.
हमारा alternative "greater than" है, इसलिए हमें right-tailed टेस्ट चाहिए.
एक p-value है
किसी test statistic को देखने की probability
उतनी ही चरम या उससे अधिक चरम
जितनी हमारे मूल सैंपल में देखी गई,
मानते हुए कि null hypothesis सही है.
prop_child_samp <- stack_overflow %>%
summarize(point_estimate = mean(age_first_code_cut == "child")) %>%
pull(point_estimate)
0.388
prop_child_hyp <- 0.35
std_error <- 0.0096028
z_score <- (prop_child_samp - prop_child_hyp) / std_error
3.956
pnorm() normal CDF है.lower.tail = TRUE रखें.lower.tail = FALSE सेट करें.
p_value <- pnorm(z_score, lower.tail = FALSE)
3.818e-05
R में Hypothesis Testing