# Does data transformed in a certain way from a normal distribution fit some other common distribution?

I have sampled a number of $x$ values from a normal distribution with mean 0 and sd 0.2. I then transformed these $x$ values to $y$ values using the formula $y = e^x/(e^x + 1)$. I know that the $y$ values will have a mean of 0.5 and all lie between 0 and 1.

• Do these y values fit some common distribution?
• Is there a way to figure this out in R?

What I am looking for is if there is a simple distribution to describe the y values that would allow me to describe it in terms of a few parameters and possibly sample directly from it in R.

-
the distribution is given by a few parameter already with your definition ? what is the difference for the application you havde in mind, between sampling things directly and using a transfomation after sampling ? –  robin girard Oct 19 '10 at 6:20
To sample y, just sample x from a Normal(0, 0.2) distribution and compute y = e^x/(e^x+1). You can use (0, 0.2) as the parameters: by means of this formula they completely determine the distribution. –  whuber Oct 19 '10 at 16:25

You have:

$X \sim N(\mu,\sigma^2)$

By definition:

$Y = \frac{e^X}{e^X+1}$

Therefore, the cdf of $Y$ is:

$P(Y \le y) = P(\frac{e^X}{e^X+1} \le y)$

Simplifying the RHS, we get:

$P(Y \le y) = P(X \le -log(\frac{1-y}{y}) )$

Therefore,

$P(Y \le y) = \Phi(-log(\frac{1-y}{y}),\mu,\sigma^2)$

Differentiating the above wrt $y$, we get the pdf $f(y)$ as:

$f(y) = (\frac{1}{y(1-y)}) \phi(-log(\frac{1-y}{y}),\mu,\sigma^2)$

I do not think the above pdf has a standard name.

onestop identifies the correct name for the pdf in his answer: Logit-normal distribution.

Reg how to sample it in R you can use the inverse-transform sampling. The idea is as follows:

1. Generate a uniform random variate: $U \sim U[0,1]$

2. Set $U = \Phi(-log(\frac{1-y}{y}),\mu,\sigma^2)$ and invert for $y$.

However, the use of the inverse method sampling is not necessary as a you could just sample values of $Y$ by sampling from $X$ first and then doing the logistic transformation (as given in your question).

-

This is called a logit-normal distribution (by analogy with the much more common log-normal distribution). Knowing that doesn't simplify sampling from it, however, or change the parameters used to describe it, which are still the mean and SD (or variance) of the parent normal distribution.

-
Unless I'm misleading, the second moment are not exactly identical between the two. –  chl Oct 19 '10 at 7:18
@chi - I meant the usual parameterisation of the logit-normal is in terms of the mean and SD of the related normal dist, not that the mean and SD of the logit-normal are the same as that of the related normal. Sorry if that was, or still is, unclear - i'm editing in a hurry as i should really have left for work by now! –  onestop Oct 19 '10 at 7:29