Please excuse any incorrect terminology. I want to adjust the curve of a logistic function to make it more or less steep while still reaching the asymptote points at the same value of x.

Here is a standard logistic function $f(x) = \frac{L-a}{1+e^{-k(x-x_0)}}+a$ where L=1, a=0, k=1, $x_0=0$: standard logistic function

I know that I can change the steepness by changing k. For example, if k=0.5 I get the line shown in red: logistic function with k=0.5

I can change the minimum and maximum values of f(x) by changing a and L, respectively. I can change the x value where f(x) hits the midpoint between a and L by changing $x_0$.

My goal is to have a function such as this:
$$ g(x) = \begin{cases} 0 & \quad \text {if } x<-5 \\ f(x) & \quad \text {if } -5\geq x\leq 5\\ 1 & \quad \text {if } x>5 \end{cases} \ $$

Where f(x) looks like the line shown here in yellow as given by $f(x)= \frac{1.1-(-0.9)}{1+e^{-0.05(x-0)}}+-0.9$: goal function in yellow

This yellow line has the 'steepness' of the function where k=0.5 (red line) but has approximately the same minimum and maximum (x, f(x)) points as the standard logistic function (blue line). I arrived at the current yellow line by manually adjusting a and L values until the line looked correct.

My questions are:

  1. Is there some other transformation I can use on the logistic function to make it look like the yellow line (without manually guessing values for L and a)?

  2. Is there a different/better formula than the logistic function I can use to get a curve that looks like this yellow line?

  • 1
    $\begingroup$ Is it important for the function to be eventually constant, as in your example $g$? There are several different types of sigmoid functions, one of which may suit your needs, but most of them are merely asymptotic rather than eventually constant. $\endgroup$ – dbx Jan 24 '18 at 0:43
  • $\begingroup$ It's fine if it's not eventually constant. I basically care about using a sigmoid function to get between two points. Then I can use other functions on either side of those points to make it constant. @dbx $\endgroup$ – Katie Jan 24 '18 at 2:07
  • $\begingroup$ Another question (I'm working on this in my spare time, which is not abundant): Do you need to be able to specify the point where the sigmoid intersects the constant tail - in your example $g$, you chose $x=5$. Is it important that you can choose that value? $\endgroup$ – dbx Jan 24 '18 at 17:24
  • $\begingroup$ Yes, I do. I am using this to estimate growth of attach rates/take rates (% of people who buy base product that will buy this add-on) of a product add-on that's being introduced to the market. I'm getting information on what we expect the initial attach rate (when the product is introduced) and the final attach rate (after some set amount of time) to be, but I want to use a Sigmoid curve to demonstrate different possibilities of what growth looks like between those two points. $\endgroup$ – Katie Jan 24 '18 at 19:16

I think I understand now what you're trying to do, and I may have a workable solution for you. First let's state the goal:

We want to find a piecewise function $g(x)$ on $(-\infty, \infty)$ such that for some $\varepsilon > 0$ we have $g(x)=y_m$ for all $x < x_0-\varepsilon$ and $g(x)=y_M$ for all $x > x_0+\varepsilon$, and such that $g(x)$ is sigmoid for $x$ between $x_0-\varepsilon$ and $x_0+\varepsilon$. Additionally, you would like to be able to control the slope of the sigmoid part.

If we let $f$ be the logistic curve you chose: $$ f = a + \frac{L-a}{1 + e^{-k(x-x_0)}} $$ then $$ f'= k(a-L) \frac{e^{k(x+x_0)}}{\left( e^{kx} + e^{k x_0} \right)^2}$$ The curve achieves its maximum slope at $x=x_0$, given by $$ f'(x_0)= \frac{1}{4}k(L-a) $$

Your first step is to choose the "steepness" $m=f'(x_0)$. Using the above, we get the constraint: $$ k=\frac{4m}{L-a} \qquad (1) $$ Now we need another equation relating $k$ and $L-a$ so that we can solve for their values. This is provided by the requirement that $f(x_0+\varepsilon)=y_M$, i.e.: $$ y_M=a+\frac{L-a}{1+e^{-k\varepsilon}} $$ Using $(1)$ in the above gives: $$ y_M = a + \frac{L-a}{1 + e^{-\frac{4m\varepsilon}{L-a}}} $$ Using symmetry, we can write $a=y_m + y_M - L$ and therefore $L-a=2L-(y_m+y_M)$. Plugging this in to the above, we can solve for $L$ in: $$ y_M = y_m+y_M-L + \frac{2L-(y_m+y_M)}{1 + e^\frac{-4m\varepsilon}{2L-(y_m+y_M)}}$$ At this point, things get really ugly. You can solve numerically using the method of your choice, though. Once you have $L$, you can find $a$ using the relation $a=y_m+y_M-L$ from before. Now that you have values for $k$, $a$, and $L$, you are done! Define:

$$ g(x) = \left\{\begin{matrix} y_m, & x < x_0 - \varepsilon \\ \frac{L-a}{1 + e^{-k(x-x_0)}}, & x_0-\varepsilon \leq x < x_0+ \varepsilon \\ y_M, & x \geq x_0 + \varepsilon\end{matrix} \right. $$

Here is an example of using this method with $m=2$, $\varepsilon=4$, $x_0=1$, $y_m=-2$, and $y_M=3$:


| cite | improve this answer | |

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.