### Eight schools

*Eight schools* estimates the effect of coaching programs in eight schools. The data are 8 measurements of coaching effects along with their standard errors.

See also the [Stan example](https://github.com/stan-dev/example-models/wiki/ARM-Models-Sorted-by-Type#varying-intercept) for details.

#### data
```{r schools_data, highlight = FALSE}
y <- c(28,  8, -3,  7, -1,  1, 18, 12)
sigma_y <- c(15, 10, 16, 11,  9, 11, 10, 18)
N  <- length(y)
```

#### greta code
```{r schools_greta}
sigma_eta <- inverse_gamma(1, 1)
eta <- normal(0, sigma_eta, dim=N)

mu_theta <- normal(0, 100)
xi <- normal(0, 5)
theta <- mu_theta + xi * eta

distribution(y) <- normal(theta, sigma_y)
```

#### Stan code
<div class="stan">
```{r schools_stan, echo = FALSE}
cat(readLines('https://raw.githubusercontent.com/stan-dev/example-models/master/ARM/Ch.19/schools.stan'), sep = '\n')
```
</div>
