Does Jacobian Warning persists despite making adjustment

Hi, just a quick question. I make a simple transformation in my model and get the warning:
“Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.”

Since then, I have made the correction, but the warning persists? Does that imply I have made the wrong correction or does the warning just show despite the target += statement with the log absolute determinante of the Jacobian have been made?

It cannot tell if you made the correction, much less if it is correct, so it throws the warning whenever it sees something that is not a parameter or data on the left-hand side of a ~.

1 Like

Thank you for the quick reply. Again, I am not sure, that I, based on the manual, has understood correctly when it is necessary to make the adjustment. The issue is, that I know the distribution of a standardized variabel, X, i.e. I know that (X-my)/sigma~g(.) So in the the program in the transformed variabel block, I make the variabel e = (X-my)/sigma, where X is data and my and sigma are parameters. Is correction with respect to the Jacobian necessary here in Stan?

That depends on my (mu?) and sigma, when they are non-linear transformations
then a Jacobian adjustment is needed. Since you take the sqrt … in your earlier
post, you would need.

The good news is that you don’t need to specify your model like this. Suppose
you have a normal err distribution, you could specify err ~ normal(0, sigma);
But now you have this skewed student-t, so you could map your sigma to
the corresponding parameter in that distribution or do an Jacobian adjustment.

1 Like

To be clear - do you mean make the distribution like X~g(mu, sigma, ny, xi) where g(.) is the skewed t-distribution and adjust the location and dispersion parameters respectively?

You defined in another post:

real MskT_lpdf(real z, real nu, real xi)

I assume z is the mean, you could code it as:

(X-mu) ~ MskT_lpdf(0, nu, xi);

(I just copied your function here. I miss the DF)

Now you might define a mapping of your skewness, variance, DF and mu.
mu is already done, you have to go the paper and look how the moments
are defined and then map it to your parameters.

1 Like