"jacobian not necessary" for transformed normal location parameter?

Section 22.2 of the Stan reference manual mentions that a Jacobian adjustment is not needed when “the transformed parameters are being used rather than given a distribution”. I’m curious how this can be in my specific case where I have something like the following.

data {
  vector<lower=0>[m] dA[n];
  vector[m] x[n];
  real<lower=0> sigma;

parameters {
  real<lower=0> A0[n];
  vector[m] y;

transformed parameters {
  vector[m] mu[n];
  for (i in 1:n) {
    mu[i] = y - log(A0[i] + dA[i]);

model {
  for (i in 1:n) {
    x[i] ~ normal(mu[i], sigma);

The above model would appear to need no Jacobian adjustment, and Stan does not raise any message to that effect. It seems to me that an equivalent model would be to swap x[i] with mu[i] in the model block; however in that case this would need a Jacobian adjustment. In both cases the pdf is the same (since it’s symmetric for x and mu), so how to understand this difference?

If you are not putting a prior on mu, then you still have a valid posterior distribution for y and A0. Swapping mu with x in the model block is not an equivalent model even though the normal (log) PDF evaluates to the same number. In the latter case, you would need a Jacobian adjustment because mu[i] is a nonlinear function of A0[i] and without that adjustment, you would be drawing from a different posterior distribution than the one you intend.

Thanks, that satisfies my curiosity. Just to be clear, I am putting a prior on mu via a normal prior on y and a lognormal prior on A0 + dA. That doesn’t affect the validity of the posterior, correct?

I, for one, would not really call it a prior on mu, since it is a function of dA[i], which is data. You could say that before you observe da[i], your generative model implies that mu[i] has some conditional probability whose form depends on the prior distribution you use for y and A0.