So that transformations (for example) can be placed closer to their context of use to make code more readable. Something along the lines of this:
metastan(
data = {
J : int(lower=0)
y[J] : real
sigma[J] : real(lower=0)
},
parameters {
mu : real
tau : real(lower=0)
eta[J] : real
},
transformed_parameters {
theta[J] : real
for (j in 1:J) {
theta[j] <- mu + tau * eta[j]
}
},
model {
eta ~ normal(0, 1)
y ~ normal(theta, sigma)
}
)
becomes more like this:
metastan({
J : int(lower=0)
y[J] : real
mu : real : parameters
tau : real(lower=0) : parameters
eta[J] : real : parameters
eta ~ normal(0, 1)
#or maybe
eta[J] : real @parameters
#or
parameters::eta[J] : real
{
theta[J] : real
for (j in 1:J) {
theta[j] <- mu + tau * eta[j]
}
}@transformed_parameters
#or maybe
transformed_parameters: {
...
}
#or maybe
transformed_parameters = {
...
}
data::sigma[J] : real(lower=0)
y ~ normal(theta, sigma)
)
So that transformations (for example) can be placed closer to their context of use to make code more readable. Something along the lines of this:
becomes more like this: