On 4/26/13 2:56 AM, Sebastian Weber wrote:
> Thanks Bob!
>
> A warning here is very helpful to catch unwanted mistakes.
Right -- we'd been meaning to include one for ages but
I only recently added the necessary information to the parser
to do the check.
> I understand that putting a prior on a parameter or
> transformed parameter makes conceptually no difference and both approaches can result in a properly setup model.
> However, to me it looks like the policy should be that priors are on parameters only. So many thanks for a warning here
> - it will keep at least me from making my own mistakes...
Under the hood, a Stan model defines an unnormalized
conditional probability of parameters given data.
Sometimes it's convenient to define a transformation
of a parameter and put the prior on that or vice-versa.
For example, suppose you have a Dirichlet variate
K-vector alpha, with alpha[k] > 0. You can reparameterize
in terms of a K-simplex theta and a total count alpha_sum > 0.
alpha = alpha_sum * theta
alpha_sum = sum(alpha)
theta = alpha / sum(alpha)
Now suppose we want to express the prior on the transformed
parameters:
alpha_sum ~ exp(a)
theta ~ dirichlet(beta);
We can do this in Stan with either (alpha) or (alpha_sum,theta)
as the declared parameters. If we take alpha to be the declared
parameters, we need to apply a Jacobian adjustment. If (alpha_sum,theta)
are the declared parameters, we define alpha in terms of them and don't
need an adjustment.
- Bob