Ändere das Modell, um eine informative Prior zu verwenden
Der angezeigte Code ist das alte Modell, das du in Kapitel 2 von Grund auf entwickelt hast.
Diese Übung ist Teil des Kurses
<Kurs>Grundlagen der Bayes'schen Datenanalyse in R</Kurs>Übungsanweisungen
- Ändere dieses Modell so, dass es die neue informative Prior für
proportion_clicksverwendet, die du gerade ausgewählt hast:
rbeta(n_draws, shape1 = 5, shape2 = 95)
Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
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))