2
$\begingroup$

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:

  1. @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?
  2. 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)!
$\endgroup$
11
  • 2
    $\begingroup$ For the answer to (1), please use the formula I gave in my answer rather than the (not quite correct) formula you quote at the outset. For (2), use the fact that $\lambda$ typically is a small integer or a reciprocal of a small integer. $\endgroup$
    – whuber
    Mar 28 '19 at 15:55
  • $\begingroup$ @whuber, thanks for the reply. (1) folded root of p = root of p - root of (1 - p) is the definition given at stata.com/users/njc/topichlp/transint.hlp . I also read Nick Cox's version in the linked question above to be the formula as I gave it (he also quotes Tukey). I haven't been able to find a copy of Tukey's book 'Exploratory Data Analysis' online to check there yet. Is stata.com wrong? $\endgroup$
    – Izy
    Mar 28 '19 at 16:51
  • $\begingroup$ (2) I'm afraid I still can't see where to start on the maths for this. I am looking for an equation for back transformation (I haven't been able to find one whereas they are widely explained for common transformations like logit). I would definitely appreciate a step by step run through of the maths too. $\endgroup$
    – Izy
    Mar 28 '19 at 16:55
  • 2
    $\begingroup$ There is a subtle difference between @whuber's presentation and mine -- which corresponds to different versions in Tukey's work. The basic idea of folded transformations for proportions $p$ between $0$ and $1$ is to use a transformation $g()$ in folded manner, as $g(p) - g(1 - p)$. For example, $g(p)$ might be $\ln p$, $\sqrt p$, etc. In all cases, the result is $0$ at $p = 0.5$, positive for $p > 0.5$ and negative for $p < 0.5$. Tukey sometimes refines this to ensure not only identical values at $p = 0.5$, but also identical slopes at that point. The refinement is to divide by $2g'(1/2)$. $\endgroup$
    – Nick Cox
    Mar 28 '19 at 23:49
  • 3
    $\begingroup$ As far as I can recall, Tukey just uses examples of the general rule for such "matching" but @whuber neatly gave the general recipe. I omit this divisor for simplicity, as did Tukey much of the time and have many other expositors, but there is no fundamental objection to it, and it certainly allows emphasis on the transformations as being a close family. $\endgroup$
    – Nick Cox
    Mar 28 '19 at 23:53
2
$\begingroup$

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)$.

  1. 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:

f(p) against p for different version of folded root formula

  1. 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.

$\endgroup$
2
  • 1
    $\begingroup$ (+1) Generally, there is no neat formula. One would use numerical methods to perform the inverse transformation. $\endgroup$
    – whuber
    Mar 29 '19 at 13:51
  • $\begingroup$ Okay, thanks @whuber. So in that case it's sensible to choose values of lambda, like 1/2, for which back-transformation is (relatively) numerically straightforward, at least in my case where I would like to back-transform confidence intervals. $\endgroup$
    – Izy
    Mar 29 '19 at 14:17
1
$\begingroup$

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
$\endgroup$
4
  • 1
    $\begingroup$ Great! Your definition of the folded power gives a more extreme transformation at λ=(1/2) (more similar to the logit but straighter for moderately small/large values of p) than the definitions used by whuber and Nick Cox. $\endgroup$
    – Izy
    Apr 1 '19 at 13:22
  • 1
    $\begingroup$ A modification of the R code works for @Nick Cox's version of the folded root: # f_nc <- function(x, lambda) x^lambda - (1-x)^lambda # f_inv_nc <- function(q, lambda, ...) uniroot(function(x)f_nc(x, lambda)-q, interval=c(0, 1), extendInt="no", ...)$rootgda $\endgroup$
    – Izy
    Apr 1 '19 at 13:24
  • 1
    $\begingroup$ But it doesn't seem to work for @whuber's version of the folded root, which I've coded into R as # f_whuber <- function(x,lambda) (x^lambda - (1-x)^lambda)/(2*lambda*0.5^(lambda-1)). I'll have to check if there's a function other than uniroot that would do the trick. $\endgroup$
    – Izy
    Apr 1 '19 at 13:31
  • $\begingroup$ Correction - a 'gda' crept in on the end of the 'root' in my second comment above, which is the only reason that it wasn't working. So the back-transformation does work for whuber's version of the folded root as well, although it breaks for p=0 and p=1 if the value of the folded root has been rounded down/up. Thanks @kjetil b halvorsen, really nice! $\endgroup$
    – Izy
    Apr 1 '19 at 16:17

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.