25 Lecture 16 - 2019

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

  1. Increase the adapt_delta argument. This results in better step size adaption and, as a consequence, slower exploration.
  2. 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.1 Same clusters

Proceed as usual

Push samples back through the model (eg. link and sim)

25.3.2 New clusters

“New chimpanzees”

For new population, individual (alpha in above example) parameters are irrelevant

Three approaches:

  1. “Average” actor - the average chimp statistically at the population mean (alpha bar).
    1. Alpha = alpha bar.
    2. Replace varying intercept samples with 0s so all actors have average intercept row.
    3. Use link or directly simulate.
  2. Marginal actor - sample a number of statistical actors and average over the distribution.
    1. Extract samples from sigma actor
    2. Simulate new varying intercepts
    3. Use simulated intercepts to simulate predictions
  3. Show samples of actors from posterior
    1. 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.