The answer to all of your questions is that it’s just a linear transform. Our uppper-bound is a log transform, as is a lower bound. If you have upper and lower bounds, it’s a logit transform. For the simplex, it’s stick breaking. The behavior is fully defined by the Jacobian that corrects for the transform.
All sizes have to be integer data.
No, it should read beta ~ normal(mu, sigma)
. That’s the cool part. You get the non-centered parameterization through the transform. The model stats in its more natural form (that is, the way everyone writes it in papers).
Non-centered parameterization
vector<loc = mu, scale = sigma>[K] beta;
...
beta ~ normal(mu, sigma);
Centered parameterization
vector<loc = 0, scale = 1>[K] beta;
...
beta ~ normal(mu, sigma);
loc = 0, scale = 1
is the default, like lower = -infinity, upper = infinity
.
You need to work through the formula for the normal log density and the Jacobian of the transform to see how it all works out.
Nothing presupposes even a location-scale distribution (such as normal or Student-t) here. So you could use this with a lognormal, or a gamma, or anything else you want. This is similar for our lower and upper bounds. We can write real <lower = 0> sigma
and then combine that with sigma ~ normal(0, 1)
and we get a half-normal due to the combination of the full normal and constraint. That is, everything’s just compositional as defined.
It’s more general. We don’t need to apply it to just normall. We can’t guarantee the paramete will be standard normal in the prior or in the posterior. We often “standardize” predictors by mapping a vector x
to z(x) = (x - mean(x)) / sd(x)
, which makes sure that the vector z(x)
has a sample mean of zero and sample sd of 1. But what we’re really aiming for is something that’s roughly standard normal in the posterior.
I agree it’s clunky and potentially confusing with the names in statistics. But it’s not standardizing, so I don’t like standardizing_loc
.
We could use intercept
and slope
to make it clear it’s linear and remain neutral and not confuse things with the normal parameter names.
I don’t think we want to go down the ggplot2 route for the name of something simple like this. We don’t use standardizing_lower
or anything like that and it really adds verbosity where we don’t want it in the variable definitions (making it hard to scan the variable names). I’m thinking we need to go the other way and make things like pos_real
for real<lower = 0>
and prob
or unit_real
for real<lower = 0, upper = 1>
.