How to determine sigmoid function's equation from list of points?

292 Views Asked by At

I've got a list of few points and I'm trying to find the corresponding curve's representation / equation.

Here are the points:

x y
6 0
20/3 (6.666666) 0
7 0.143
8 0.8125
25/3 (8.333333) 1
9 1

I already tried to use Microsoft Excel to draw the curve (in blue, using scatter plot) and find it's equation, and by tracing it's trendline (the dotted one in red), wich I used a polynomial with order 3 to draw it because it was the more representative of my need (The more I increase the order, the more it accentuates the peak (from the bottom as from the top) by making it more "pointed").

excel representation

wich give me the equation:

y = -0.1701 x³ + 3.8355 x² - 28.112 x + 67.337

It somewhat correspond to my need but have 2 inconvenient:

  • This trendingline is an aproximation, so if x = 7 it will give 0.1482 (instead of 0.143) and for x = 8 it will result by 0.8218 (instead of 0.8125).
  • When displayed entirely on a site like Graph Pottler, we can see the curve going from +∞ to -∞ on the Y axis.

graph potler's representation of the trendingline

I need a function who match perfectly the given value of my list, where y = 0 for each x between ]-∞;20/3] and y = 1 for each x between [25/3;+∞[.

I'm guessing my curve would be a Sigmoid function, looking more like: representation of the ideal curve

while keeping in the Y interval of [0;1].

I don't really need the curve, I'm looking for the formula, not in case of studies / homework but for an informatical program. And only integer number for X are revelant (I won't try to replace X by a float number). Is my goal achievable ? or impossible / abstract because I do lack to much mathematical level ?

1

There are 1 best solutions below

1
On BEST ANSWER

The simplest solution I can think of is to fit a straight line through the points $x = 7$ and $x = 8$. The next step is to take into account that the minimum value of the function is given by $f = 0$ and the maximum value by $f = 1$. The calculation itself is quite simple. The result is:

$$f(x) = 0 \space for \space x \le C_1$$ $$f(x) = -4.5435 + 0.6695 \space x \space for \space \space C_1 \le x \le C_2$$ $$f(x) = 1 \space for \space C_2 \le x$$

The constants $C_1$ and $C_2$ are given by: $C_1 = 45435/6695 = 6.7864...$ and $C_2 = 55435/6695 = 8.2801...$.