Consider the classical model Normal-Normal-Inserse-Gamma model: $$ x=(x_1,...,x_n)|\mu,\sigma^2\sim N(\mu,\sigma^2)\,\,(iid),\,\,\mu\sim N(m_0,\tau),\sigma^2\sim IG(a,b), $$ where $m_0,\tau,a,b$ are known.

Suppose My interest is $\phi=\mu/\sigma$. So the usual path would be: obtaining the posterior distribution of $(\mu,\sigma^2)$, then take the variable transformation $\phi=\mu/\sigma$ and marginalize the posterior distribution in order to obtain $p(\phi|x)$.

As an alternative, I was wondering, can we adjust the likelihood in order to obtain an expression involving $\phi$ and assign a prior distribution directly to $\phi$? I mean: \begin{align} L(\mu,\sigma^2) & \propto (\sigma^2)^{-n/2}\exp(\frac{1}{2}\sum\left(\frac{x_i-\mu}{\sigma}\right)^2 \\ & \propto (\sigma^2)^{-n/2}\exp(\frac{1}{2}\sum\left(\frac{x_i}{\sigma}-\phi\right)^2 \\ & \propto (\sigma^2)^{-n/2}\exp(\frac{1}{2\sigma^2}\left[\sum\left(x_i-\bar{x}\right)^2+n\left(\phi\sigma^2-\bar{x}\right)^2\right], \end{align} so, as this point could I just assign some prior distribution to $\phi\sim p(\phi)$ and regard the $\sigma$ as constant? I know this is not the same model are the first one, but from the probabilistic point of view, is this ok?

  • $\begingroup$ This is not possible since the likelihood depends on both $\sigma$ (incl. within the exponential term) and $\phi$. $\endgroup$
    – Xi'an
    Apr 12, 2022 at 13:03

1 Answer 1


You can specify your prior distribution in any way that let's you then determine $\mu$ and $\sigma$ (uniquely) so that you can insert the transformed parameter values into the likelihood. Whether that is still going to lead to a nice tractable analytical approach, is another question.

If you are willing to do MCMC sampling instead of working with analytical solutions, writing this down as Stan code could be quite helpful and make it quite easy to sample from anything you want (you can of course declare any priors you want and then transform the parameters back in the transformed parameters block into $\mu$ and $\sigma$ for insertion into the likelihood. E.g.

data {
  int N;
  real x[N];
parameters {
  real mu;
  real<lower=0> sigma;
transformed parameters {
  real phi;
  phi = mu/sigma;
model {
  // insert whatever priors you like e.g. mu ~ normal(0,10); sigma ~ normal(0,1);
  // or some complex log-pdf like target += log_normal_inv_gamma_pdf(mu, sigma....);
  x ~ normal(mu, sigma);
  • $\begingroup$ Thanks for the reply, however that's not quite what I asked. My doubt is a theoretical question, can I rethink of the original model as a function of another quantity $\phi$? This might have to do with sufficient statistics, but I am not sure how to formulate this. Thanks. $\endgroup$
    – Ludwig
    Apr 12, 2022 at 17:10
  • $\begingroup$ I kind of does answer the Q. You need to define your prior so that it defines a joint prior for mu & tau (joint includes independent priors). If you only set a prior on phi, there are still multiple joint prior distributions for mu & tau that are consistent with that. If you introduce an additional constraint (e.g. something about the marginal prior distribution for one of the two), you can go that way. E.g. if you define a joint prior for mu & phi (or sigma & phi, or mu and log phi, or ....), you can through a change of variables get the implied prior for mu & sigma. $\endgroup$
    – Björn
    Apr 12, 2022 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.