क्या डेटा हमारी कहानी से मेल खाता है?
आपने no-hitters को Exponential distribution से मॉडल किया है. रियल डेटा का ECDF बनाएँ. थिओरेटिकल CDF को डेटा के ECDF के साथ ओवरले करें. इससे आप जाँच सकते हैं कि Exponential distribution देखे गए डेटा को कितना अच्छी तरह बताता है.
ECDF निकालने के लिए आपने पिछले कोर्स में जो function बनाया था, और उसे plot करने के लिए लिखा गया कोड, उन्हें याद करना उपयोगी हो सकता है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Statistical Thinking in Python (Part 2)
अभ्यास निर्देश
- no-hitters के बीच का वास्तविक समय (
nohitter_times) से ECDF निकालें. प्रीक्वेल कोर्स में आपने जोecdf()फंक्शन लिखा था, वही इस्तेमाल करें. - पिछले अभ्यास में लिए गए थिओरेटिकल सैंपल्स (
inter_nohitter_time) से एक CDF बनाएँ. x_theorऔरy_theorको लाइन के रूप मेंplt.plot()से प्लॉट करें. फिर रियल डेटा के ECDFxऔरyको पॉइंट्स के रूप में ओवरले करें. ऐसा करने के लिए,plt.plot()के अंदरxऔरyके साथmarker = '.'औरlinestyle = 'none'कीवर्ड आर्ग्युमेंट्स भी दें.- प्लॉट पर 2% मार्जिन सेट करें.
- प्लॉट दिखाएँ.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Create an ECDF from real data: x, y
x, y = ____
# Create a CDF from theoretical samples: x_theor, y_theor
x_theor, y_theor = ____
# Overlay the plots
plt.plot(____, ____)
plt.plot(____, ____, marker=____, linestyle=____)
# Margins and axis labels
plt.margins(____)
plt.xlabel('Games between no-hitters')
plt.ylabel('CDF')
# Show the plot
plt.show()