Arithmetic error when calculating inverse of the logistic?

158 Views Asked by At

I would like to rearrange the logistic function:

$$y=\frac1{1+\exp(-a+bx)}$$

To calculate $x=f(y)$

So I did the following:

$$\frac1{y}=1+\exp(-a+bx)$$ $$\ln\left(\frac1{y}-1\right)=-a+bx$$ $$\frac{\ln\left(\frac1{y}-1\right) +a}{b}=x$$

but when I try to plot this function, it appears that I have lost a '-' somewhere, i.e., I have calculated $-x=f(y)$

Where I have missed the negative sign?

2

There are 2 best solutions below

4
On

I am not allowed to comment, so I will answer. First, your algebra is correct. If you plotted it, you must have specified numeric values for a, b. I tried a=2, b=1 and the plots looked totally inverse, just as they should [except the sigmoid was decreasing i.e. reflected in y-axis as compared to usual logistic], so if your plots did not look inverse to each other, what values of a,b did you use? If you tell us that, perhaps we could say more.

0
On

Your answer is indeed correct. For $y \in (0,1)$ you'll get a function decreasing from $+\infty$ for $y=0^+$ to $-\infty$ as $y \to 1$ as it should. Remember that the graph of the inverse function is obtained by mirroring the graph around the line $x=y$.