If I have a normal distribution with a given mean and variance and apply a logistic transform to it, what is the mean and variance of my transformed variable?

This seems like it has to be a well known problem, but I haven't been able to find a quick reference anywhere.

  • 6
    $\begingroup$ Neither the distribution nor its moments are likely to have any simple closed form. It is definitely the case that the first two moments will not adequately describe the distribution in many circumstances (it can be rather skewed). Given these significant limitations, perhaps you could explain why you want to do this? $\endgroup$
    – whuber
    Jun 18 '13 at 19:16
  • $\begingroup$ There may be some value in this answer $\endgroup$
    – Glen_b
    May 30 '17 at 8:35

Given $X$ ~ $N(\mu,\sigma^2)$, you seek the transformation:

$$Y = \frac{1}{1+\exp(-X)}$$

The pdf of $Y$ has domain of support on (0,1).

  • If $\mu$ is zero, the pdf of $Y$ will be symmetrical on (0,1), so the mean, $E[Y] = \frac12$, for all $\sigma$.

  • If $\mu$ is non-zero, the pdf is skewed, and the moment calculations do not appear easy, assuming a closed-form does exist.

Nevertheless, we can quite easily find the pdf of $Y$. You can do this using the method of transformations, or one of the alternative methods. Here, I am using the mathStatica add-on to Mathematica to do the grunt work. If $X$ has pdf f, then the pdf of $Y$, say $g(y)$ is:

enter image description here

defined on (0,1).

Here is a plot of the pdf $g(y)$ when $\mu=0$, with various values for $\sigma$:

enter image description here

And here is a plot of the pdf $g(y)$ when $\sigma=1$, with various values for $\mu$:

enter image description here

OP wrote: This seems like it has to be a well known problem

It is a variation on the Johnson $S_B$ (bounded) system of distributions. See Johnson's 1949 paper for more details ...

  • Johnson, N.L. (1949), Systems of frequency curves generated by methods of translation, Biometrika, 36, 149-176.

The moments of the $S_B$ system are extremely complicated. Johnson (1949) did obtain a solution for the mean (using his formulation, which is a bit different to the above), though it did not have a closed form.


(In response to the question in the title rather than the body, on which I have nothing to add to wolfies' answer)

Wolfies has already given the distribution of the logit-normal but I thought I'd show that it's relatively simple to derive.

Let $X\sim N(\mu,\sigma^2)$ and let $Y= t(X) = 1/(1+e^{-X})$.

\begin{eqnarray} P(Y\leq y) &=& P[t(X)\leq y]\\\ &=& P[X\leq t^{-1}(y)]\\ &=& P[X\leq \log(\frac{y}{1-y})]\\ &=& P[\frac{X-\mu}{\sigma}\leq \frac{\log(\frac{y}{1-y})-\mu}{\sigma}]\\ &=&\Phi(\frac{\log(\frac{y}{1-y})-\mu}{\sigma}), \, 0<y<1 \end{eqnarray}

and then simple differentiation to obtain the pdf

\begin{eqnarray} f_Y(y) &=& \frac{1}{\sigma}\frac{d\log(\frac{y}{1-y})}{dy} \phi(\frac{\log(\frac{y}{1-y})-\mu}{\sigma})\\ &=& \frac{1}{\sigma}\frac{1}{y(1-y)} \phi(\frac{\log(\frac{y}{1-y})-\mu}{\sigma}) ,\: 0<y<1 \end{eqnarray}

Or you could get the same thing using the formula $f_Y(y)= f_X(t^{-1}(y)) \left|\frac{d t^{-1}(y)}{dy}\right|$ more directly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.