1. Learn
  2. /
  3. Courses
  4. /
  5. Bayesian Modeling with RJAGS

Exercise

Define, compile, & simulate the Normal-Normal

Upon observing the change in reaction time \(Y\)i for each of the 18 subjects \(i\) enrolled in the sleep study, you can update your posterior model of the effect of sleep deprivation on reaction time. This requires the combination of insight from the likelihood and prior models:

  • likelihood: \(Y\)i \(\sim N(m, s^2)\)
  • priors: \(m \sim N(50, 25^2)\) and \(s \sim Unif(0, 200)\)

In this series of exercises, you'll define, compile, and simulate your Bayesian posterior. The observed sleep_study data are in your work space.

Instructions 1/3

undefined XP
    1
    2
    3

DEFINE your Bayesian model and store the model string as sleep_model. In doing so, note that:

  • dnorm(a, b) defines a \(N(a, b^{-1})\) model with precision (ie. inverse variance) \(b\).

  • dunif(a,b) defines a \(Unif(a,b)\) model.

  • The model of \(Y\)i depends upon \(m\) and \(s\). The number of subjects \(i\) is defined by length(Y).