Looking for an equation which follows a Sigmoidal distribution.

61 Views Asked by At

I have some data that I would like to go as input on a function as $x$, its values range from 1 to ~5000. I would like to have $f(x)$ output values which follow a sigmoid like distribution.

I was able to find some equations that do that. The problem is that they don't include -1 and 1 values in $f(x)$'s range. Without saying I would need its values to be in range of $[0,1]$ instead of $]-1,1[$.

How can I maybe change one of those equations in a way that $f(x)$ follows these restrictions? As this image shows I was able to put $erf(x)$'s between ]0,1[ but not [0,1].

3

There are 3 best solutions below

2
On

Try using $\sigma (x)= \frac{1}{1+e^{-x+2500}}$ for $0 <x<5000$ with $\sigma (0) =0$ and $\sigma (5000) = 1$ otherwise.

The values of the logistic curve are extremely close to $0$ and $1$ at $x=0$ and $x=5000$ so it wouldn’t make a difference anyway. It’s close enough that an average calculator wouldn’t be able to notice the difference.

2
On

Here is an example of a smooth function that is $0$ for $x \le 0$ and $1$ for $x \ge 1$. It is defined as $\frac{f(x)}{f(x) + f(1-x)}$ where $f(x) = \begin{cases} e^{-1/x} & x > 0 \\ 0 & x \le 0 \end{cases}$.

2
On

If you have any function $f: [0,5000] \to \mathbb{R}$ that you like, i.e. sigmoid-like, smooth, monotonic, etc, and the only problem you have is that $f(0) > a$ slightly and $f(5000) < b$ slightly, when you would like exactly $f(0)=a, f(5000)=b$, then how about just rescaling the thing vertically?

$$a + {b - a \over f(5000) - f(0)} (f(x) - f(0))$$

Many of the curves you found do not reach their asymptotic values. If you want to artificially reach the asymptotic values, and you know exactly where you want to reach them (at $0$ and at $5000$) then rescaling is the easiest.

The OP mentioned "~5000" though, so I am not sure you want to reach the higher asymptotic value at exactly $5000$...