Arithmetic error when calculating inverse of the logistic?

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?

-
Are you sure your original function is written correctly? Shouldn't $x$ have a negative coefficient? –  Qiaochu Yuan Apr 19 '11 at 22:41
@Qiaochu Do you mean $y=\frac{-1}{1+\text{exp}(-a+bx)}$? –  Abe Apr 20 '11 at 15:29

@Rita I was using $[a,b]= [-20.6, 0.25]$, a maximum likelihood fit for a logistic regression model to data. I was trying to invert the equation to predict x from y, but apparently I made the mistake of starting with the wrong equation. –  Abe Apr 20 '11 at 15:36
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$.