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

टेस्ट स्टैटिस्टिक का विज़ुअलाइज़ेशन

इस अभ्यास में, आप शून्य परिकल्पना (null hypothesis) को दो अलग-अलग तरीकों से प्राप्त किए गए टेस्ट स्टैटिस्टिक के वितरण की तुलना करके समझेंगे.

पहले, आप दो "populations" देखेंगे, जिन्हें early और late times के आधार पर समूहित किया गया है, और टेस्ट स्टैटिस्टिक का वितरण निकालेंगे। दूसरे, इन दोनों populations को shuffle करें ताकि डेटा time-ordered न रहे और प्रत्येक में early और late times का मिश्रण हो, फिर टेस्ट स्टैटिस्टिक का वितरण दोबारा निकालें.

शुरू करने के लिए, हमने दो time duration समूह group_duration_short और group_duration_long, और दो फंक्शन shuffle_and_split() और plot_test_statistic() पहले से लोड कर दिए हैं.

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

Python में Linear Modeling परिचय

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

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

  • np.random.choice() का उपयोग करके group_duration_short और group_duration_long को resample करें, और resamples का अंतर लेकर test_statistic_unshuffled निकालें.
  • मूल group_duration_short और group_duration_long पर (इसी क्रम में) shuffle_and_split() का उपयोग करके दो नई mixed populations बनाइए.
  • shuffled populations को resample करें, और resample_long में से resample_short घटाकर नया test_statistic_shuffled निकालें.
  • plot_test_statistic() का उपयोग करके दोनों टेस्ट स्टैटिस्टिक distributions को प्लॉट करें और विज़ुअली तुलना करें.

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

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

# From the unshuffled groups, compute the test statistic distribution
resample_short = np.random.choice(____, size=500, replace=____)
resample_long = np.random.choice(____, size=500, replace=____)
test_statistic_unshuffled = ____ - ____

# Shuffle two populations, cut in half, and recompute the test statistic
shuffled_half1, shuffled_half2 = shuffle_and_split(____, ____)
resample_half1 = np.random.choice(____, size=500, replace=____)
resample_half2 = np.random.choice(____, size=500, replace=____)
test_statistic_shuffled = resample_half2 - resample_half1

# Plot both the unshuffled and shuffled results and compare
fig = plot_test_statistic(____, label='Unshuffled')
fig = plot_test_statistic(____, label='Shuffled')
कोड संपादित करें और चलाएँ