1. The Normal-Normal model
In Chapter 1, you reviewed some foundational Bayesian concepts and got a glimpse into defining, compiling, and simulating Bayesian models using RJAGS. You did so in the setting of the one-parameter Beta-Binomial model for a proportion p.
2. Chapter 2 goals
In Chapter 2, you'll engineer another foundational model, the two-parameter Normal-Normal,
and learn how to define, compile, and simulate this model in RJAGS.
You'll also explore Markov chains, the mechanics behind an RJAGS simulation. Let's start with a story.
3. Sleep deprivation
A research team asks "How does sleep deprivation impact reaction time?". Motivated by this question, the researchers develop a sleep study.
They start by measuring subjects' reaction times to a stimulus on Day 0 and,
subsequently, restrict subjects' sleep to only 3 hours per night.
On Day 3, they re-measure the subjects' reaction times. The observed *changes* in reaction times on Day 3 vs Day 0 provide insight into the potential impact of sleep deprivation on reaction time.
4. Modeling change in reaction time
In an analysis of the study results, we start by building a *model* of the phenomena of interest. To this end, let $Y_i$ be the change in reaction time (measured in milliseconds) for some subject $i$. We use the $i$ subscript here to distinguish between observations on different subjects. Of course, people react differently to sleep deprivation, thus $Y_i$ can vary from subject to subject.
It's reasonable to assume that this biological phenomenon is Normal, that is, that the $Y_i$ are *Normally* distributed around some *average* change in reaction time $m$ with *standard deviation* $s$.
The mathematical notation shown here communicates and specifies this assumption.
5. Prior model for parameter $m$
Notice that the Normal model depends upon two parameters. The first of these is $m$, the average change in reaction times $Y_i$. Previous sleep studies similar to ours provide prior insight into $m$.
First, with *normal* sleep, we know that the average reaction time among all adults is somewhere around 250 ms.
Further, after 3 days of sleep deprivation, average reaction times should increase by around 20%, or 50 ms. This information specifies the location and shape of our Normal prior for $m$.
6. Prior model for parameter $m$
We also expect that the average reaction time is unlikely to *decrease* after 3 days of sleep deprivation. It's also unlikely to *increase* by more than 150 ms. This information specifies the scale of the prior.
7. Prior model for parameter $m$
Together, the shape, location, and scale of the $m$ prior model correspond to a Normal distribution with mean 50 and standard deviation 25 milliseconds, communicated using notation here.
8. Prior model for parameter $s$
Next, consider the second parameter in the Normal model of change in reaction times $Y_i$: standard deviation $s$.
As a standard deviation, we know that $s$ is positive.
Further, under normal sleep conditions, we know that the standard deviation in reaction times is roughly 30 milliseconds.
Without further information we assume that $s$ is equally likely to be anywhere between 0 and 200 milliseconds.
Thus the prior model for $s$ is a Uniform distribution on the interval from 0 to 200. This isn't the *best* prior model, but it will suit our current purposes just fine.
9. The Normal-Normal Model
We've now engineered a Normal-Normal Bayesian model! To recap, we assumed that the changes in reaction time $Y_i$ have a Normal likelihood structure. That is, the $Y_i$ are Normally distributed around some mean $m$ with standard deviation $s$.
10. The Normal-Normal Model
We then tuned Normal and Uniform prior models of these two model parameters. In turn, the priors provide insight into the shape and scale of the likelihood model.
11. Let's practice!
Now before jumping into an RJAGS simulation of the Normal-Normal posterior model, you will use simulation techniques to explore the likelihood and prior pieces of this Bayesian model in the following exercises.