# Bayesian Analysis of Box-Cox Transformation

This problem is problem 5 in Chapter 7 of Bayesian Data Analysis, 3rd edition. Consider the Box-Cox transformation:

$y_i^{(\lambda)} \sim \mathcal{N}(\mu, \sigma^2)$

where

$y_i^{(\lambda)} = (y_i^{\lambda}-1)/\lambda$ for $\lambda \neq 0$,

$y_i^{(0)} = \log y_i$

To do Bayesian inference, we need to specify a prior $p(\mu, \sigma^2, \lambda)$.

From the question: "It seems natural to apply a prior distribution $p(\mu, \log \sigma, \lambda) \propto p(\lambda)$, where $p(\lambda)$ is a prior distribution (perhaps uniform) on $\lambda$ alone. Unfortunately, this leads to unreasonable results. Set up a numerical example to show why. (Hint: consider what happens when all the data points $y_i$ are multiplied by a constant factor.)"

From this information, the prior I have to consider is $p(\mu, \sigma^2, \lambda) \propto p(\lambda)/\sigma^2$, since $1/\sigma^2$ translates to the uniform prior on $\log \sigma$. The likelihood is as follows:

$p(y_1,...,y_n | \mu, \sigma^2, \lambda) \propto \prod_{i=1}^n\frac{1}{\sigma} \exp\left(-\frac{1}{2\sigma^2}\left(\frac{y_i^{\lambda}-1}{\lambda}-\mu\right)^2\right)$

because $P(\lambda = 0) = 0$ since it is a continuous distribution.

So the posterior is proportional to

$\frac{p(\lambda)}{\sigma^3}\prod_{i=1}^n \exp\left(-\frac{1}{2\sigma^2}\left(\frac{y_i^{\lambda}-1}{\lambda}-\mu\right)^2\right)$

I don't see why specifying the prior as we did would lead to unreasonable results. I'm not sure what it means by "set up a numerical example." Also, the hint didn't really point me in any direction. It seems like if you multiply every data point by a constant you just get

$\frac{p(\lambda)}{\sigma^3}\prod_{i=1}^n \exp\left(-\frac{1}{2\sigma^2}\left(\frac{(cy_i)^{\lambda}-1}{\lambda}-\mu\right)^2\right)$

which still seems fine.

• Commented Feb 25, 2017 at 14:07

This is precisely because the full conditional distribution of $$\lambda$$ is missing its Jacobian term. You've assigned a normal distribution on $$y_i^*(\lambda) = \frac{y_i^\lambda - 1}{\lambda} \sim N(\mu,\sigma^2)$$, whereas your full conditional distribution is expressed in terms of $$y_i$$, not $$y_i^*(\lambda)$$. Therefore, you should multiply the following Jacobian: $$\mathrm{d}y_i^* = y_i^{\lambda-1}\,\mathrm{d}y_i \Rightarrow \mathcal{J}(y^*\to y)=\prod_{i=1}^n y_i^{\lambda-1}.$$