ट्रेंड के आसपास का वैरिएशन
डेटा का पूरी तरह linear होना ज़रूरी नहीं है, और मापों में कुछ रैंडम वैरिएशन या "फैलाव" हो सकता है. यह मॉडल पैरामीटर्स में भी वैरिएशन के रूप में दिखता है. इस वैरिएशन को "standard error" से मापा जाता है, और इसे मॉडल पैरामीटर के अनुमान में "अनिश्चितता" के रूप में समझा जाता है.
इस अभ्यास में, आप statsmodels के ols का उपयोग करके एक मॉडल बनाएँगे और उस मॉडल के प्रत्येक पैरामीटर के लिए standard error निकालेंगे.

यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Linear Modeling परिचय
अभ्यास निर्देश
- प्रीलोडेड डेटा को DataFrame
dfमें स्टोर करें, जहाँx_dataकोtimesऔरy_dataकोdistancesके रूप में लेबल करें. model_fit = ols().fit()का उपयोग करके एक linear मॉडल फिट करें, रूपformula="distances ~ times"के साथ,data=dfपर.- अनुमानित इंटरसेप्ट
model_fit.params['Intercept']और स्लोप के standard error कोmodel_fit.bse['Intercept']से निकालें. - स्लोप के लिए भी यही दोहराएँ, और फिर चारों मानों को सार्थक नामों के साथ प्रिंट करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Store x_data and y_data, as times and distances, in df, and use ols() to fit a model to it.
df = pd.DataFrame(dict(____=x_data, ____=y_data))
model_fit = ols(____="distances ~ times", data=____).____()
# Extact the model parameters and their uncertainties
a0 = model_fit.____['Intercept']
e0 = model_fit.____['Intercept']
a1 = model_fit.____['times']
e1 = model_fit.____['times']
# Print the results with more meaningful names
print('Estimate of the intercept = {:0.2f}'.format(____))
print('Uncertainty of the intercept = {:0.2f}'.format(____))
print('Estimate of the slope = {:0.2f}'.format(____))
print('Uncertainty of the slope = {:0.2f}'.format(____))