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

BMI और HDL के नतीजों का मूल्यांकन

वे मरीज जो BMI के टॉप 10% और HDL के टॉप 25% दोनों में आते हैं, उनकी predicted disease progression (response y) उन मरीजों की तुलना में कितनी अलग है जो BMI के सबसे निचले 10% और HDL के सबसे निचले 25% दोनों में आते हैं? फिर से, आपके लिए simulation पहले से चलाया जा चुका है: आपका काम df_results में simulation के नतीजों का मूल्यांकन करके इस सवाल का जवाब ढूँढना है!

निम्न लाइब्रेरी पहले से import की गई हैं: pandas को pd के रूप में, numpy को np के रूप में, और scipy.stats को st के रूप में.

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

Python में Monte Carlo Simulations

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

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

  • mean outcome की परिभाषाएँ पूरी कीजिए: पहले उन मरीजों के लिए results को filter करें जो BMI के टॉप 10% और HDL के टॉप 25% दोनों में हैं, और फिर उन मरीजों के लिए जो BMI के सबसे निचले 10% और HDL के सबसे निचले 25% दोनों में हैं. इसके लिए hdl_q25, hdl_q75, bmi_q10, bmi_q90 का उपयोग कीजिए, जो आपके लिए पहले से परिभाषित हैं.

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

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

simulation_results = st.multivariate_normal.rvs(mean=mean_dia, size=20000, cov=cov_dia)
df_results = pd.DataFrame(simulation_results,columns=["age", "bmi", "bp", "tc", "ldl", "hdl", "tch", "ltg", "glu"])
predicted_y = regr_model.predict(df_results)
df_y = pd.DataFrame(predicted_y, columns=["predicted_y"])
df_summary = pd.concat([df_results,df_y], axis=1)
hdl_q25 = np.quantile(df_summary["hdl"], 0.25)
hdl_q75 = np.quantile(df_summary["hdl"], 0.75)
bmi_q10 = np.quantile(df_summary["bmi"], 0.10)
bmi_q90 = np.quantile(df_summary["bmi"], 0.90)

# Complete the mean outcome definitions
bmi_q90_hdl_q75_outcome = np.mean(df_summary[(df_summary["bmi"] > bmi_q90) & (____)]____) 
bmi_q10_hdl_q15_outcome = np.mean(df_summary[(df_summary["bmi"] < bmi_q10) & (____)]____) 
y_diff = bmi_q90_hdl_q75_outcome - bmi_q10_hdl_q15_outcome
print(y_diff)
कोड संपादित करें और चलाएँ