Session Ready
Exercise

Predictive simulation

Suppose John is more interested in predicting my score y in a future reaction test. In particular, he wants to compute a prediction interval for y.

In this setting, John's current beliefs about M are contained in the normal posterior (270.5, 5.8) density.

You can compute a sample of 1000 draws from John's predictive density as follows:

M_sim <- rnorm(1000, 270.5, 5.8)
y_sim <- rnorm(1000, M_sim, 20)

Remember, the standard deviation 5.8 seconds reflects the uncertainty in the mean reaction time M and the standard deviation 20 seconds reflects the uncertainty in a single reaction score y for a fixed value of M.

Instructions
100 XP
  • Simulate 1000 values from John's posterior density for M. Assign the result to M_sim.
  • Simulate 1000 values from John's predictive density for y. Assign the result to y_sim.
  • Compute the probability I will score less on 250 on a single test.
  • Find a 90% prediction interval for my reaction test score.