swh:1:snp:4a47993778f3ff3fe6e227d2f4c1a7654fd94e50
Tip revision: bd393fa1bdd7a624be65d65cc799865503ecf8df authored by Brian Ward on 09 February 2024, 14:44:15 UTC
Merge pull request #226 from stan-dev/add-json-data-files
Merge pull request #226 from stan-dev/add-json-data-files
Tip revision: bd393fa
radon_group_chr.stan
data {
int<lower=1> N;
int<lower=1> J; // number of counties
array[N] int<lower=1, upper=J> county;
vector[N] u;
vector[N] x;
vector[N] y;
}
transformed data {
matrix[N, 2] cov = [x', u']';
}
parameters {
vector[2] beta;
real mu_a;
real<lower=0> sigma;
real<lower=0> sigma_a;
vector<offset=mu_a, multiplier=sigma_a>[J] alpha;
}
model {
mu_a ~ std_normal();
beta ~ normal(0, 100);
sigma ~ cauchy(0, 2.5);
sigma_a ~ cauchy(0, 2.5);
alpha ~ normal(mu_a, sigma_a);
y ~ normal_id_glm(cov, alpha[county], beta, sigma);
}