Eight Schools distribution¶
- class pints.toy.EightSchoolsLogPDF(centered=True)[source]¶
The classic Eight Schools example that is discussed in [1].
The aim of this model (implemented as a
pints.ToyLogPDF
) is to determine the effects of coaching on SAT scores in 8 schools (each school being denoted by subscript j in the following equations). It it used by statisticians to illustrate how hierarchical models can quite easily become unidentified, making inference hard.This model is hierarchical and takes the form,
\[\begin{split}\begin{align} \mu &\sim \mathcal{N}(0, 5) \\ \tau &\sim \text{Cauchy}(0, 5) \\ \theta_j &\sim \mathcal{N}(\mu, \tau) \\ y_j &\sim \mathcal{N}(\theta_j, \sigma_j), \\ \end{align}\end{split}\]where \(\sigma_j\) is known. The user may choose between the “centered” parameterisation of the model (which exactly mirrors the statistical model), and the “non-centered” parameterisation, which introduces auxillary variables to improve chain mixing. The non-centered model takes the form,
\[\begin{split}\begin{align} \mu &\sim \mathcal{N}(0, 5) \\ \tau &\sim \text{Cauchy}(0, 5) \\ \tilde{\theta}_j &\sim \mathcal{N}(0, 1) \\ \theta_j &= mu + \tilde{\theta}_j \tau \\ y_j &\sim \mathcal{N}(\theta_j, \sigma_j). \\ \end{align}\end{split}\]Note that, in the non-centered case, the parameter samples correspond to \(\tilde{\theta}\) rather than \(\theta\).
The model uses a 10-dimensional parameter vector, composed of
mu
, the population-level scoretau
, the population-level standard deviationtheta_j
, school j’s mean score (for each of the 8 schools).
Extends
pints.toy.ToyLogPDF
.- Parameters:
centered (bool) – Whether or not to use the centered formulation.
References
- distance(samples)¶
Calculates a measure of distance from
samples
to some characteristic of the underlying distribution.
- sample(n_samples)¶
Generates independent samples from the underlying distribution.