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
pilots.stan
data {
int<lower=0> N;
int<lower=0> n_groups;
int<lower=0> n_scenarios;
array[N] int<lower=1, upper=n_groups> group_id;
array[N] int<lower=1, upper=n_scenarios> scenario_id;
vector[N] y;
}
parameters {
vector[n_groups] a;
vector[n_scenarios] b;
real mu_a;
real mu_b;
real<lower=0, upper=100> sigma_a;
real<lower=0, upper=100> sigma_b;
real<lower=0, upper=100> sigma_y;
}
transformed parameters {
vector[N] y_hat;
for (i in 1 : N) {
y_hat[i] = a[group_id[i]] + b[scenario_id[i]];
}
}
model {
mu_a ~ normal(0, 1);
a ~ normal(10 * mu_a, sigma_a);
mu_b ~ normal(0, 1);
b ~ normal(10 * mu_b, sigma_b);
y ~ normal(y_hat, sigma_y);
}