When I read a reference stan code I am confused about the following statement in the ‘model’ part of Stan:
data{
real<lower = 0> sigma;
real mu;
}
paramter{
real b1;
real b2;
real b3;
}
model{
{b1, b2, b3} ~ normal(mu, sigma);
}
I am not sure what does ‘{b1, b2, b3} ~ normal(mu, sigma);’ means here since when I used rstan to run the stan file, the error message said that:
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
Illegal statement beginning with non-void expression parsed as
b1
Not a legal assignment, sampling, or function statement. Note that
- Assignment statements only allow variables (with optional indexes) on the left;
- Sampling statements allow arbitrary value-denoting expressions on the left.
- Functions used as statements must be declared to have void returns
So I changed the Stan code as:
data{
real<lower = 0> sigma;
real mu;
}
paramter{
real b1;
real b2;
real b3;
}
model{
b1 ~ normal(mu, sigma);
b2 ~ normal(mu, sigma);
b3 ~ normal(mu, sigma);
}
May I ask that are these two Stan codes equivalent? If not, what’s the meaning of '{b1, b2, b3} ~ normal(mu, sigma); '?