25 Lecture 16
25.1 Multiple clusters
Example: chimpanzees * block
“cross classified”
Add actor and block intercepts - alpha for each actor, gamma for each block, beta for each treatment
Think of these as an offset
\(\alpha_{j} \sim \text{Normal}(\bar{\alpha}, \sigma_{alpha})\)
\(\gamma{j} \sim \text{Normal}(0, \sigma_{gamma})\)
\(\bar{\alpha} \sim \text{Normal}(0, 1.5)\)
In this example, sigma for actors shows variation in actors, but sigma for blocks is quite small. Why include blocks then? Because while out of sample predictions are quite similar, the block parameters are aggressively regularized.
Random effects have many definitions. These are statistical things used to regularize inference. Doesn’t necessarily have to be only things “not fixed by the experimenter”.
25.2 Divergent transitions
Tells you something is numerically inefficient about the model. Solution = switch between different ways of writing the same model.
Each transition is a sample path. Since in real physics energy is conserved, if energy isn’t conserved in the physics simulation within the HMM - something went wrong.
HMC thankfully reports warnings, whereas Gibbs, Metropolis, etc do not (since they are not a physics simulation)
25.2.1 Solutions for divergent transitions
- Increase the adapt_delta argument. This results in better step size adaption and, as a consequence, slower exploration.
- Reparameterize the model
Reparameterizing the model takes a “centered” model and transforms it into a “non-centered” model. Even though they are mathematically the same, it helps with sampling. Eg. funnel → Gaussian hill
Result is a z-score centered, “non-centered”, much easier to sample and yields more effective samples. Chains will also run faster.
25.3 Posterior predictions with multilevel models
25.3.2 New clusters
“New chimpanzees”
For new population, individual (alpha in above example) parameters are irrelevant
Three approaches:
- “Average” actor - the average chimp statistically at the population mean (alpha bar).
- Alpha = alpha bar.
- Replace varying intercept samples with 0s so all actors have average intercept row.
- Use link or directly simulate.
- Marginal actor - sample a number of statistical actors and average over the distribution.
- Extract samples from sigma actor
- Simulate new varying intercepts
- Use simulated intercepts to simulate predictions
- Show samples of actors from posterior
- Sample and plot individuals simulated from posterior
Note the effects at the limits are reduced because of ceiling and floor effects of generalized linear models. Eg near 0-1 bounds, the effects will be reduced.