Bayesian मॉडल के लिए R-squared
अब आइए Bayesian मॉडल के लिए R-squared निकालें ताकि हम stan_glm से अनुमानित मॉडलों की प्रेडिक्शंस का आकलन कर सकें। stan_model ऑब्जेक्ट पहले से लोड है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
rstanarm के साथ Bayesian Regression Modeling
अभ्यास निर्देश
stan_modelके रेज़िडुअल का वैरिएंस निकालेंstan_modelके फिटेड वैल्यूज़ का वैरिएंस निकालें- R-squared की गणना करें
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Save the variance of residulas
ss_res <- ___(___(stan_model))
# Save the variance of fitted values
ss_fit <- ___(___(stan_model))
# Calculate the R-squared
1 - (___ / (___ + ___))