दो मॉडलों की तुलना करें
पिछले अभ्यास में आपने distance100 और arsenic को explanatory वैरिएबल्स के रूप में लेकर एक मॉडल फिट किया था। इस अभ्यास में आप प्रत्येक जोड़े गए वैरिएबल के कारण मॉडल फिट पर पड़े प्रभाव का विश्लेषण करेंगे।
याद करें कि आपने जो मॉडल फिट किए थे, वे निम्नलिखित हैं और वर्कस्पेस में पहले से लोड हैं:
model_dist = 'switch ~ distance100'model_dist_ars = 'switch ~ distance100 + arsenic
डेटासेट wells भी वर्कस्पेस में प्रीलोडेड है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Generalized Linear Models
अभ्यास निर्देश
- जब
distance100को null मॉडल में जोड़ा जाए, तो deviance में अंतर निकालें. - जब
arsenicकोdistance100वैरिएबल वाले मॉडल में जोड़ा जाए, तो deviance में अंतर निकालें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Compute the difference in adding distance100 variable
diff_deviance_distance = ____.____ - ____.____
# Print the computed difference in deviance
print('Adding distance100 to the null model reduces deviance by: ',
round(____,3))
# Compute the difference in adding arsenic variable
diff_deviance_arsenic = ____.____ - ____.____
# Print the computed difference in deviance
print('Adding arsenic to the distance model reduced deviance further by: ',
round(____,3))