# What is the inverse cdf / ppf of the logit-normal distribution?

In this post, I am trying to implement the logit-normal distribution in Python. The provided answer works for me, however, the rvs method that draws random variates failes for me. According to the documentation of the pdf class that I am using:

"The default method _rvs relies on the inverse of the cdf, _ppf, applied to a uniform random variate. In order to generate random variates efficiently, either the default _ppf needs to be overwritten (e.g. if the inverse cdf can expressed in an explicit form) or a sampling method needs to be implemented in a custom _rvs method."

This is what I am trying to figure out, but I couldn't find a description of the inverse logit-normal cdf anywhere. How do I do this?

I assume you want to generate $$X$$ where $$Y=\log_e\left(\frac{X}{1-X}\right)\sim \mathcal N(\mu,\sigma^2)$$
So generate $$Y$$, either directly from a normal distribution, or from a $$U \sim \mathcal U(0,1)$$ and $$Y = \mu +\sigma\Phi^{-1}(U)$$, and then let $$X=\frac{e^Y}{e^Y+1}=\frac{1}{1+e^{-Y}}$$. Combine these and you could say $$X=\frac{1}{1+e^{-\mu -\sigma\Phi^{-1}(U)}}$$ and in a sense this is the inverse of the cumulative distribution function of the logit-normal distribution
• Thank you! Just to be sure, $\Phi^{-1}$ is the inverse cumulative normal distribution, correct?
• @mapf - yes, for a standard normal $\mathcal N(0,1)$ Commented Mar 18, 2020 at 11:06