करंट का प्रभाव लेन पोज़ीशन पर कैसे निर्भर करता है?
परफॉर्मेंस पर लेन नंबर के प्रभाव को मापने के लिए, f_13 बनाम lanes डेटा पर एक linear regression चलाएँ. 95% confidence interval पाने के लिए pairs bootstrap कैलकुलेशन करें. अंत में, regression का प्लॉट बनाएँ. ऐरे lanes और f_13 पहले से आपके namespace में हैं.
ध्यान दें कि हम mean fractional differences पर error bars निकालकर उन्हें regression में इस्तेमाल कर सकते थे, लेकिन यह इस कोर्स के दायरे से बाहर है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Statistical Thinking के केस स्टडीज़
अभ्यास निर्देश
np.polyfit()का उपयोग करकेf_13बनामlanesलाइन का slope और intercept निकालें.dcst.draw_bs_pairs_linreg()का उपयोग करके slope और intercept के 10,000 bootstrap replicates लें, और उन्हें क्रमशःbs_reps_slopeऔरbs_reps_intमें स्टोर करें.- bootstrap replicates का उपयोग करके slope के लिए 95% confidence interval निकालें.
- slope और 95% confidence interval स्क्रीन पर प्रिंट करें. यह आपके लिए किया जा चुका है.
np.array()का उपयोग करके प्लॉट में bootstrap लाइनों के लिए x-values जनरेट करें.xको1से8तक जाना चाहिए.- प्लॉट में डेटा पहले से मौजूद है. 100 bootstrap लाइनों को जोड़ने के लिए एक
forलूप लिखें, और keyword argumentscolor='red',alpha=0.2, औरlinewidth=0.5का उपयोग करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Compute the slope and intercept of the frac diff/lane curve
____, ____ = ____
# Compute bootstrap replicates
bs_reps_slope, bs_reps_int = ____
# Compute 95% confidence interval of slope
conf_int = ____
# Print slope and confidence interval
print("""
slope: {0:.5f} per lane
95% conf int: [{1:.5f}, {2:.5f}] per lane""".format(slope, *conf_int))
# x-values for plotting regression lines
x = ____
# Plot 100 bootstrap replicate lines
for i in ____:
_ = ____(____, ____[i] * ____ + ____[i],
color='red', alpha=0.2, linewidth=0.5)
# Update the plot
plt.draw()
plt.show()