Revision 819f01b12701f9d8d85f19fcb3d73a86011931b5 authored by Rok Cesnovar on 01 March 2021, 19:15:33 UTC, committed by Rok Cesnovar on 01 March 2021, 19:15:33 UTC
1 parent ffd35e9
Raw File
radon_intercept.stan
data {
  int<lower=1> N;
  int<lower=1> J; # number of counties
  int<lower=1,upper=J> county[N];
  vector[N] y;
}
parameters {
  real mu_a;
  real<lower=0> sigma_a;
  real<lower=0> sigma_y;
  vector<offset=mu_a, multiplier=sigma_a>[J] a; # county intercepts
}
model {
  mu_a ~ std_normal();
  sigma_a ~ cauchy(0, 2.5);
  sigma_y ~ cauchy(0, 2.5);
  a ~ normal(mu_a, sigma_a);
  y ~ normal(a[county], sigma_y);
}

back to top