Posterior predictive distribution
weight_chains डेटा फ्रेम (आपके वर्कस्पेस में) में 180 cm लंबे वयस्क के वज़न के लिए आपकी 100,000 posterior भविष्यवाणियाँ Y_180 शामिल हैं:
> head(weight_chains, 2)
a b s iter m_180 Y_180
1 -113.9029 1.072505 8.772007 1 79.14803 71.65811
2 -115.0644 1.077914 8.986393 2 78.96014 75.78893
आप इन 100,000 भविष्यवाणियों का उपयोग 180 cm लंबे वयस्क के वज़न के लिए posterior predictive distribution को लगभगित (approximate) करने के लिए करेंगे. bdims डेटा आपके वर्कस्पेस में उपलब्ध है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
RJAGS के साथ Bayesian Modeling
अभ्यास निर्देश
- 10,000
Y_180मानों का उपयोग करके 180 cm लंबे वयस्क के वज़न के लिए 95% posterior credible interval बनाइए. - अपनी 100,000 posterior सम्भावित भविष्यवाणियों का डेंसिटी प्लॉट बनाइए.
bdimsमेंwgtबनामhgtडेटा का एक स्कैटरप्लॉट बनाइए.- posterior रिग्रेशन ट्रेंड ओवरले करने के लिए
geom_abline()का उपयोग करें. geom_segment()का उपयोग करकेhgt= 180 पर एक वर्टिकल लाइन ओवरले करें, जोci_180की निचली और ऊपरी सीमाएँ (yऔरyend) दर्शाती है.
- posterior रिग्रेशन ट्रेंड ओवरले करने के लिए
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Construct a posterior credible interval for the prediction
ci_180 <- quantile(___, probs = c(___, ___))
ci_180
# Construct a density plot of the posterior predictions
ggplot(___, aes(x = ___)) +
geom_density() +
geom_vline(xintercept = ci_180, color = "red")
# Visualize the credible interval on a scatterplot of the data
ggplot(___, aes(x = ___, y = ___)) +
geom_point() +
geom_abline(intercept = mean(___), slope = mean(___), color = "red") +
geom_segment(x = 180, xend = 180, y = ___, yend = ___, color = "red")