Session Ready
Exercise

Poisson posterior prediction

Your l_weekday variable reflects the trend in volume on 80 degree weekdays:

> head(poisson_chains, 2)
       a b.1.    b.2.      c l_weekend l_weekday
1 5.0198    0 -0.1222 0.0141   465.924   412.324
2 5.0186    0 -0.1218 0.0141   466.284   412.829

Now that you understand the trend, let's make some predictions! Specifically, let's predict trail volumes on the next 80 degree weekday. To do so, you must take into account individual variability from the trend, modeled by the likelihood \(Y\)i \(\sim Pois(l\)i).

Using rpois(n, lambda) for sample size n and rate parameter lambda, you will simulate Poisson predictions of volume under each value of the posterior plausible trend in poisson_chains.

Instructions
100 XP
  • From each of the 10,000 l_weekday values in poisson_chains, use rpois() to predict volume on an 80 degree weekday. Store these as Y_weekday in poisson_chains.
  • Use ggplot() to construct a density plot of your Y_weekday predictions.
  • Approximate the posterior probability that the volume on an 80 degree weekday is less than 400 users.