शुरू करेंमुफ़्त में शुरू करें

P-Value का विज़ुअलाइज़ेशन

इस अभ्यास में, आप p-value को विज़ुअलाइज़ करेंगे — यानी यह संभावना कि जो प्रभाव (या "speed") हमने अनुमानित किया, वह सैंपल में रैंडम वैरिएशन के कारण आया हो. आपका लक्ष्य इसे इस तरह दिखाना है कि शफ़ल्ड टेस्ट स्टैटिस्टिक डिस्ट्रीब्यूशन में वे बिंदु, जो अनशफ़ल्ड सैंपल से निकले टेस्ट स्टैटिस्टिक के औसत ("effect size") के दाएँ तरफ़ आते हैं, उनका अंश कितना है.

शुरू करने के लिए, हमने group_duration_short और group_duration_long तथा फंक्शन compute_test_statistic(), shuffle_and_split(), और plot_test_statistic_effect() पहले से लोड कर दिए हैं.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Linear Modeling परिचय

पाठ्यक्रम देखें

अभ्यास निर्देश

  • compute_test_statistic() का उपयोग करके group_duration_short और group_duration_long से test_statistic_unshuffled पाएँ; फिर np.mean() से effect size निकालें.
  • shuffle_and_split() का उपयोग करके shuffle_half1 और shuffle_half2 बनाएँ, और compute_test_statistic() से test_statistic_shuffled निकालें.
  • एक बूलियन मास्क condition बनाएँ ताकि test_statistic_shuffled के वे मान जो effect_size से बड़े या बराबर हैं, चुने जाएँ; फिर इसी मास्क से p_value की गणना करें.
  • p_value प्रिंट करें और plot_test_statistic_effect() का उपयोग करके दोनों टेस्ट स्टैटिस्टिक प्लॉट करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Compute the test stat distribution and effect size for two population groups
test_statistic_unshuffled = compute_test_statistic(____, ____)
effect_size = np.mean(____)

# Randomize the two populations, and recompute the test stat distribution
shuffled_half1, ____ = shuffle_and_split(group_duration_short, ____)
test_statistic_shuffled = compute_test_statistic(shuffled_half1, ____)

# Compute the p-value as the proportion of shuffled test stat values >= the effect size
condition = ____ >= ____
p_value = len(test_statistic_shuffled[____]) / len(test_statistic_shuffled)

# Print p-value and overplot the shuffled and unshuffled test statistic distributions
print("The p-value is = {}".format(____))
fig = plot_test_stats_and_pvalue(test_statistic_unshuffled, test_statistic_shuffled)
कोड संपादित करें और चलाएँ