n 8/14/12 11:07 AM, Andrew Gelman wrote:
> J
> I prefer the version that was on the webpage, that you already had before, using
I'm not sure what web page you're talking about.
Given that you (Andrew) seem to care the most about
which version of Eight Schools we use, could you
perhaps write it out in Stan notation for us?
When you get back we can give you a tutorial on
Git and our web pages and get you checking things in
yourself so that we can cut out the middleman.
> the notation mu, tau, and with no prior
> on tau.
To get started, here's a repeat of what I last
sent with un-suffixed variable names and with tau
interpreted as a precision as in the model in the appendix
of BDA Andrew said we should follow.
data {
int[0,] J; // number of schools
real y[J]; // estimated treatment effect (school j)
real[0,] sigma[J]; // std dev of effect estimate (school j)
}
parameters {
real theta[J];
real mu;
real[0,1000] tau;
}
model {
mu ~ normal(0,1000);
theta ~ normal(mu, 1/sqrt(tau)); // ??? precision to scale
y ~ normal(theta,sigma);
}
This is the vectorized version. Unvectorized, you'd replace the
model body with:
mu ~ normal(0,1000);
for (j in 1:J) {
theta ~ normal(mu, 1/sqrt(tau));
y ~ normal(theta,sigma);
}
The reason I wrote it as I originally did:
data {
int[0,] J; // number of schools
real y[J]; // estimated treatment effect (school j)
real[0,] sigma_y[J]; // std dev of effect estimate (school j)
}
parameters {
real theta[J];
real mu;
real[0,1000] sigma_theta;
}
model {
mu_theta ~ normal(0,1000);
theta ~ normal(mu, sigma_theta);
y ~ normal(theta,sigma_y);
}
is that I was trying to be consistent in how we
named variables in our models. It helps a lot with
understanding programs and hence coding them and
maintaining them. For instance, the lack of such a
convention is why I can't tell if the tau you want
us to use is a scale or a precision. Varying notation
and terminology is especially hard on beginners.
BDA/ARM introduced a convention of subscripting location
and scale/precision parameters with the name of the variate.
BDA/ARM also used sigma for scale parameters and tau
for precisions, though I believe in some cases tau were also
used for scale parameters, which is why I don't know which
one to use just based on the name "tau".
Are there other coding conventions? I'll add an appendix
to the manual at some point.
- Bob