Aan de slagGa gratis aan de slag

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).

Deze oefening maakt deel uit van de cursus

Fundamentals of Bayesian Data Analysis in R

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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))
___
Code bewerken en uitvoeren