मॉडल को एक informative prior इस्तेमाल करने के लिए बदलें
दिखाया गया कोड वही पुराना मॉडल है जिसे आपने अध्याय 2 में शून्य से बनाया था.
यह अभ्यास पाठ्यक्रम का हिस्सा है
R में Bayesian डेटा विश्लेषण की बुनियाद
अभ्यास निर्देश
- इस मॉडल को बदलकर
proportion_clicksके लिए नया informative prior इस्तेमाल करें, जिसे आपने अभी चुना है:
rbeta(n_draws, shape1 = 5, shape2 = 95)
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
n_draws <- 100000
n_ads_shown <- 100
# Change the prior on proportion_clicks
proportion_clicks <-
runif(n_draws, min = 0.0, max = 0.2)
n_visitors <-
rbinom(n_draws, size = n_ads_shown,
prob = proportion_clicks)
prior <-
data.frame(proportion_clicks, n_visitors)
posterior <-
prior[prior$n_visitors == 13, ]
# This plots the prior and the posterior in the same plot
par(mfcol = c(2, 1))
hist(prior$proportion_clicks,
xlim = c(0, 0.25))
hist(posterior$proportion_clicks,
xlim = c(0, 0.25))