How to back transform a folded root? I have some data where the response variable is a proportion, and I am experimenting with transformation using Tukey's family of folded powers, $f(p) = p^\lambda - (1 - p)^\lambda$, with values of $\lambda$ from 0 to 1.
Folded roots are nicely described by @Nick Cox here: https://stats.stackexchange.com/a/195305/212689
and @whuber here: https://stats.stackexchange.com/a/10979/212689.
Trying to get my head round this, I have a couple of questions:


*

*@whuber states that 'When $\lambda = 1/2$ we get the folded root, or "froot," $f(p) = \sqrt{1/2}\left(\sqrt{p} - \sqrt{1-p}\right)$.' Assuming that this is the same use of $\lambda$ as in the equation I give above, I'm struggling to see how to rearrange to get $\sqrt{1/2}$ at the beginning of the equation. Can anyone explain?

*How do I back-transform from $f(p)$ to get back to $p$? Again, I'm struggling with the maths (especially as $(1 - p)^\lambda$ is a never-ending binomial expansion)!

 A: Okay, so with help from @whuber and @Nick Cox (thank you!), I think I can now answer this for a folded root with $\lambda=(1/2)$.


*

*a. @Nick Cox gives the formula $f(p) = p^\lambda - (1 - p)^\lambda$ for
the folded root.
b. @whuber gives the formula $f(p) = \sqrt{1/2}\left(\sqrt{p} -
\sqrt{1-p}\right)$ for the folded root where $\lambda=(1/2)$.
These are different, but both are versions used by Tukey. I think that both versions are symmetrical about p=0.5, and f(0.5)=0 for both. I plotted a quick graph of f(p) against p for each version:



*I had to go about this one by writing out the algebra, squaring both sides of the equation and rearranging. Eventually I get down to the quadratic equation, with $p - p^2-c = 0$, so $a=-1$ and $b=1$ in the quadratic.


a. For @Nick Cox's formula, $c=((1-(f(p))^2)/2)^2$.
b. For @whuber's formula, $c=((1-2(f(p))^2)/2)^2$.
The quadratic formula gives us two possible solutions. If f(p) is negative, then p<0.5, and we want the solution for the quadratic form $(-b+\sqrt{b^2-4ac})/2a$. If f(p) is positive, then p>0.5, and we want the solution for the quadratic form $(-b-\sqrt{b^2-4ac})/2a$ (I'm not sure if there's a theoretical/mathematical reason for why it works out that way round?).
There may be a simpler/more elegant way to do this, I would love to hear what it is. Particularly because I am still struggling to generalise this to less simple cases e.g. $\lambda=(2/3)$, where I'm stuck at multiplying out the cubed bracket/trying to simplify from there.
A: Adding to the other excellent answer, here I just show a solution for general $\lambda$. That must be a numerical solution. First, I define the folded power as
$$
   f(p) = \frac{p^\lambda - (1-p)^\lambda}{\lambda}
$$
in analogy with the definition of the Box-Cox transformation as $\frac{y^\lambda - 1}{\lambda}$, obtaining that way a useful limit when $\lambda \to 0$, the logit function $\text{logit}(p)=\log(p)-\log(1-p)$. One can check that the folded power such defined is always monotone increasing. 
The practical way of computing the inverse is by numerics, I will just give some simple Rcode:
 f <- function(x, lambda) (x^lambda - (1-x)^lambda)/lambda
 f_inv <- function(q, lambda, ...) uniroot(function(x)f(x, lambda)-q, interval=c(0, 1), extendInt="no", ...)$root

