Fit the model using another dataset
Let's fit the binomial model to both the video ad data (13 out of 100 clicked) and the new text ad data (6 out of a 100 clicked).
Este exercicio faz parte do curso
Fundamentals of Bayesian Data Analysis in R
exercicio interativo prático
Tente este exercicio completando este código de exemplo.
# Define parameters
n_draws <- 100000
n_ads_shown <- 100
proportion_clicks <- runif(n_draws, min = 0.0, max = 0.2)
n_visitors <- rbinom(n = n_draws, size = n_ads_shown,
prob = proportion_clicks)
prior <- data.frame(proportion_clicks, n_visitors)
# Create the posteriors for video and text ads
posterior_video <- prior[prior$n_visitors == 13, ]
posterior_text <- ___
# Visualize the posteriors
hist(posterior_video$proportion_clicks, xlim = c(0, 0.25))
___