# Simplify the log of the multivariate logit (or logistic)-normal probability density function

According to wikipedia, the probability density function of the multivariate logit-normal (sometimes called logistic-normal) distribution is

$$f_X( \mathbf{x}; \boldsymbol{\mu} , \boldsymbol{\Sigma} ) = \frac{1}{ | 2 \pi \boldsymbol{\Sigma} |^\frac{1}{2} } \, \frac{1}{ \prod\limits_{i=1}^D \left(x_i(1-x_i)\right) } \, e^{- \frac{1}{2} \left\{ \log \left( \frac{ \mathbf{x} }{ 1-\mathbf{x} } \right) - \boldsymbol{\mu} \right\}^\top \boldsymbol{\Sigma}^{-1} \left\{ \log \left( \frac{ \mathbf{x}}{ 1-\mathbf{x} } \right) - \boldsymbol{\mu} \right\} }$$

I'm interested in fitting a model to some data that have this distribution. Therefore, I would like to calculate the log likelihood of the model, or $\ln{}(f_X( \mathbf{x}; \boldsymbol{\mu} , \boldsymbol{\Sigma} ))$. I imagine there must be a simplification to this formula, but it is beyond my mathematical ability to find it.

## 1 Answer

Yes, this can be simplified, however it is still not going to be very pleasant looking.

$$\log \left(f_X(x;\mu;\Sigma)\right) \\ = -\log|2\pi\Sigma |^\frac12 - {\log\left( \prod_{i=1}^D \left(x_i(1-x_i)\right) \right)} {- \frac12 \left\{ \log \left( \frac{ x }{ 1-x } \right) - \mu \right\}^\top \Sigma^{-1} \left\{ \log \left( \frac{ x}{ 1-x } \right) - \mu \right\} }\\ =-\log|2\pi\Sigma |^\frac12 - \sum_{i=1}^D{\log\left( \left(x_i(1-x_i)\right) \right)} {- \frac12 \left\{ \log \left( \frac{ x }{ 1-x } \right) - \mu \right\}^\top \Sigma^{-1} \left\{ \log \left( \frac{ x}{ 1-x } \right) - \mu \right\} }$$Of course the initial constant will not matter when differentiating this. The second term differentiates to $\frac{1-2x_j}{ x_j(1-x_j)}$. The final term is probably much more complicated, but I will give the first term. Differentiating with respect to $x_k$ gives $$\sum_i\frac12\frac{1}{x_k}\frac{1+x_k}{1-x_k}\Sigma^{-1}_{ki}\left\{\log\left(\frac{x_i}{1-x_i}-\mu\right)\right\}+\text{other similar terms}$$ This is of course due to the product rule.

• ~~Thanks! Is the question at the end rhetorical? Its the vector of your observations divided by 1 minus that vector, no?~~ I see what you mean, you can't take the log of a negative number. – sammosummo Apr 13 '18 at 19:52
• In the wikipedia article it says: "where the log and the division in the argument are taken element-wise", does this explain it? – sammosummo Apr 13 '18 at 20:31
• The end was not rhetorical, I didn't understand the meaning of dividing by a vector. If it is elementwise, then yes that makes sense. I suppose I should have noticed that haha – John Doe Apr 13 '18 at 21:30
• I think your work is correct so I've accepted the answer, however I think the equation for the multivariate logit-normal likelihood might be wrong (off be a constant or something, so I asked a new question here: math.stackexchange.com/questions/2741389/… – sammosummo Apr 17 '18 at 13:54