Dear Stanimals,

Just as I thought I got the hang of dealing with Jacobians, I’m facing a new interesting challenge where these babies may (not?) turn up:

In my model, I want to include prior information on a function of multiple parameters, in addition to marginal priors for the individual parameters. At the moment, I can’t figure out whether including this prior for the function of parameters also means I need to deal with the Jacobian (and if so, what that would look like).

I am trying to model extremely overdispersed data that has three hierarchical levels: individuals, repeated samples per individual over time, and repeated testing of the same sample. Each of these three levels is associated with considerable variation (coefficients of variation in the order of 0.25 to 4.0), which together create the overall extreme level of overdispersion. My aim is to decompose the variance into the three levels with a suite of candidate models that assume different distributions for the variation at each level (e.g., gamma or log-normal). To be able to use the same priors for each model and to fairly compare the models, I am parameterising the variance structure of each model in terms of the coefficient of variation (CV) associated with each hierarchical level: CV_1, CV_2, and CV_3. Within the model, these are transformed to parameters appropriate for the distribution being used (e.g., shape parameter for gamma, SD parameter for log-normal). Easy-peasy. But now, in addition, I want to soft-constrain the total coefficient of variation (CV_{total}), as even with very reasonable priors on CV_1, CV_2, and CV_3, CV_{total} can very quickly get out of hand (or has tails that are much wider and fatter than reasonable):

CV_{total}=\sqrt{(CV_1^2+1)(CV_2^2+1)(CV_3^2+1)-1}

So, given priors for CV_1, CV_2, and CV_3, how should I implement the addition of information on CV_{total} in Stan? Can I just state `target += some_prior_lupdf(CV_total | ..., ...)`

to my model code with impunity or do I need to handle Jacobian business as well (and if so, what on earth would that beast look like)?