# Calculate log-odds posterior distribution

Given a gamma-posterior distribution $p(\theta|y)$ I want to compute the posterior distribution for the log-odds: $log\frac{\theta}{1-\theta}$

I tried to solve it with the change of variables (hopefully this is a good start).

## Solution approach:

$p_{\theta}(\theta) = \frac{\beta^\alpha}{\Gamma(\alpha)}\theta^{-(\alpha+1)}e^{-\frac{\beta}{\theta}}$

$\phi = log\frac{\theta}{1-\theta}$; $h(\phi) = \frac{e^\phi}{e^\phi+1}$; $h'(\phi)=\frac{1}{1+e^\phi}$

$p_\phi(\phi) = p_\theta(h'(\phi))\times h'(\phi)$

$p_\phi(\phi)= (\frac{\beta^\alpha}{\Gamma(\alpha)}\frac{e^\phi}{1+e^\phi}^{-(\alpha+1)}e^{-\frac{\beta(1+e^\phi)}{e^\phi}})\frac{1}{1+e^\phi}$

## Questions:

1. Is the posterior distribution for the log-odds derived correct? (Maybe not 100% mathematically correct but mostly I care about the solution (: )

2. Would it be correct to write the log-odds distribution like that?

$p_\phi(\phi) \sim Gamma(\frac{e^\phi}{e^\phi+1} \ | \ \alpha, \beta)\times \frac{1}{1+e^\phi}$

1. Is there a way of simulating the log-odds posterior distribution out of the given posterior distribution without doing the analytics?

• For 3. Yes, you can just simulate $\theta\sim p(\theta|y)$ and then calculate $\log(\theta/[1-\theta])$ which is a draw from the posterior for the log-odds. – jaradniemi Apr 15 '16 at 16:10
• Note that if $p(\theta \mid y)$ is gamma, there is positive probability that $\theta>1$ in which case $\log \theta/(1-\theta)$ isn't even defined. If $\theta$ is a probability, its distribution should be constrained on $[0,1]$. If $\theta$ is not a probability, it's unclear what log-odds mean. – Juho Kokkala Apr 15 '16 at 17:50