Updated non-centered parametrization with offset and multiplier

Hi, I’ve recently seen this comment from @Bob_Carpenter in Andrew’s blog (https://statmodeling.stat.columbia.edu/2019/07/07/collinearity-in-bayesian-models/#comment-1075661)

As of 2.19, the non-centered parameterization can be written like this:

parameters {
  vector[K] alpha;
  real mu;
  real<lower = 0> sigma;
}
model {
  alpha ~ normal(mu, sigma);
}

But from https://mc-stan.org/docs/2_22/reference-manual/univariate-data-types-and-variable-declarations.html

It looks as if it should be

parameters {
  vector<offset = mu, multiplier = sigma>[K] alpha;
  real mu;
  real<lower = 0> sigma;
}
model {
  alpha ~ normal(mu, sigma);
}

Or is the non-centered parametrization done automatically now?

Bob also writes “In 2.20, which will be out soon, we’ll also have the multivariate version where the offset is a vector and the multiplier a Cholesky factor.” Is there an example somewhere?

And I guess that the non-centered parametrization of the user guide is a bit outdated now, right?

Best,
Bruno

1 Like

My reading is that the non centered parameterisation is now the default and the one with the offset bit in it is how you do a centered parameterisation if you want to.

It’s just a typo.

This:

parameters {
  vector[K] alpha;
  real mu;
  real<lower = 0> sigma;
}
model {
  alpha ~ normal(mu, sigma);
}

is just the standard, centered parameterization (not non-centered). The new addition is the offset multiplier syntax, which essentially removes some code duplication. The old, still more common way to write this would be

parameters {
  vector[N] alpha_std;
  real mu;
  real<lower=0> sigma;
}

transformed parameters {
  vector[N] alpha = mu + alpha_std * sigma;
}

model {
  alpha_std ~ normal(0, 1);
}

Note that in the first code snippet, the model is parameterized in terms of alpha, which is distributed as normal(mu, sigma), whereas in the second code snippet the model is parameterized in terms of alpha_std, which is then scaled and shifted with an offset and multiplier. This has the advantage that it is easier to sample from.

You may also find the original issue on github useful, which has a much better explanation than mine:

2 Likes