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

BMI आउटकम का मूल्यांकन

BMI के टॉप 10% बनाम सबसे निचले 10% में आने वाले पेशेंट्स के लिए अनुमानित रोग-प्रगति (response, y) में क्या अंतर है? आप इस सवाल का जवाब देने के लिए multivariate normal distribution से सैंपल की गई simulation के नतीजों का उपयोग करेंगे!

Simulation पहले से आपके लिए चला दी गई है: आपका काम df_results में simulation के नतीजों का मूल्यांकन करना है.

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

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

Python में Monte Carlo Simulations

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

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

  • np.quantile() का उपयोग करके simulated नतीजों में bmi के 10th और 90th quantile निकालें, और उन्हें bmi_q10 तथा bmi_q90 में सेव करें.
  • bmi_q10 और bmi_q90 का उपयोग करके df_summary को फ़िल्टर करें और predicted y वैल्यूज़ प्राप्त करें.

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

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

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)

# Calculate the 10th and 90th quantile of bmi in the simulated results
bmi_q10 = np.quantile(df_summary["bmi"], ____)
bmi_q90 = np.quantile(df_summary["bmi"], ____)

# Use bmi_q10 and bmi_q90 to filter df_summary and obtain predicted y values
mean_bmi_q90_outcome = np.mean(df_summary[____]["predicted_y"]) 
mean_bmi_q10_outcome = np.mean(df_summary[____]["predicted_y"])
y_diff = mean_bmi_q90_outcome - mean_bmi_q10_outcome
print(y_diff)
कोड संपादित करें और चलाएँ