Exercise

Predictive distribution

Good job analyzing the parameter draws! Let's now use the linear regression model to make predictions. How many clicks can we expect if we decide to show 10 clothes ads and 10 sneaker ads? To find out, you will have to draw from the predictive distribution: a normal distribution with the mean defined by the linear regression formula and standard deviation estimated by the model.

First, you will summarize each parameter's posterior with its mean. Then, you will calculate the mean of the predictive distribution according to the regression equation. Next, you will draw a sample from the predictive distribution and finally, you will plot its density. Here is the regression formula for your convenience:

The number of clicks has a normal distribution with the mean β0 + β1 * clothes-ads-shown + β2 * sneakers-ads-shown, and some standard deviation sigma.

pymc3, numpy, and seaborn have been imported under their usual aliases.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Summarize each of the drawn parameters (intercept_draws, sneakers_draws, clothes_draws, and sd_draws) by its posterior mean.