mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-28 21:01:00 +00:00
add Stan samples
This commit is contained in:
26
samples/Stan/schools.stan
Normal file
26
samples/Stan/schools.stan
Normal file
@@ -0,0 +1,26 @@
|
||||
data {
|
||||
int<lower=0> N;
|
||||
vector[N] y;
|
||||
vector[N] sigma_y;
|
||||
}
|
||||
parameters {
|
||||
vector[N] eta;
|
||||
real mu_theta;
|
||||
real<lower=0,upper=100> sigma_eta;
|
||||
real xi;
|
||||
}
|
||||
transformed parameters {
|
||||
real<lower=0> sigma_theta;
|
||||
vector[N] theta;
|
||||
|
||||
theta <- mu_theta + xi * eta;
|
||||
sigma_theta <- fabs(xi) / sigma_eta;
|
||||
}
|
||||
model {
|
||||
mu_theta ~ normal(0, 100);
|
||||
sigma_eta ~ inv_gamma(1, 1); //prior distribution can be changed to uniform
|
||||
|
||||
eta ~ normal(0, sigma_eta);
|
||||
xi ~ normal(0, 5);
|
||||
y ~ normal(theta,sigma_y);
|
||||
}
|
||||
Reference in New Issue
Block a user