Box Constraints

This section provides implementation details for how MCMCLib handles box constraints.

For a parameter \(\theta_j\) defined on a bounded interval \([a_j,b_j]\), where \(a_j < b_j\), we use the generalized logit transform:

\[g(\theta_j) = \phi_j := \ln \left( \frac{x_j - a_j}{b_j - x_j} \right)\]

with corresponding inverse transform

\[\theta_j = g^{-1} (\phi_j) = \frac{a_j + b_j \exp(\phi_j)}{1 + \exp(\phi_j)} \]

Note that the support of \(\phi_j\) is \(\mathbb{R}\).

The log posterior kernel function of the \(J \times 1\) vector \(\boldsymbol{\theta}\) is given by:

\[K(\boldsymbol{\theta} | Y) = \ln L( Y | \boldsymbol{\theta} ) + \ln \pi (\boldsymbol{\theta})\]

where \(L\) is the likelihood function of the data \(Y\) parametrized by \(\boldsymbol{\theta}\), and \(\pi\) is the joint prior distribution over \(\boldsymbol{\theta}\). The log posterior kernel function of the transformed parameter vector \(\boldsymbol{\phi} = g(\boldsymbol{\theta})\) is then computed as

\[K(\boldsymbol{\phi} | Y) = \ln L( Y | g^{-1} (\boldsymbol{\phi}) ) + \ln \pi (g^{-1} (\boldsymbol{\phi})) + \ln | J(\boldsymbol{\phi}) |\]

where \(|J|\) is the modulus of the Jacobian determinant matrix \(J\)—that is, the determinant of a matrix with \((i,j)\) elements equal to

\[\frac{\partial [g^{-1} (\phi)]_i}{\partial \phi_j} = \frac{\partial \theta_i}{\partial \phi_j}\]

If the parameters \(\boldsymbol{\theta}\) are assumed to be a-priori independent, then

\[\pi (\boldsymbol{\theta}) = \pi_1 (\theta_1) \cdots \pi_J (\theta_J) \]

Given our specification for \(g\), the Jacobian term will be a diagonal matrix with non-negative elements: the log Jacobian adjustment for parameter \(j\) is given by

\[\ln J_{j,j} := \ln \left( \frac{d \theta_j}{d \phi_j} \right) = \ln(b_j - a_j) + \phi_j - 2 \ln (1 + \exp(\phi_j)) \]

As the determinant of a diagonal matrix is the product of its diagonal elements, the final term in can be computed as a sum:

\[\ln | J(\boldsymbol{\phi}) | = \sum_{j=1}^J \ln | J_{j,j} | = \sum_{j=1}^J \left[ \ln(b_j - a_j) + \phi_j - 2 \ln (1 + \exp(\phi_j)) \right] \]