[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

Fitting a curve to data

Hi Experts,

Please look at the attached logistic data plots. I have used excel's polynomial trend line feature to fit a curve to the logistic sigmoid curves. Is there a better way or formula to fit curves to these type of plots? eng-0.xlsx
  • 2
1 Solution
I shall consider "column B" only.
There are of course many sigmoidal curves, the most prominent being 1/(1+e^(-t)).
Probably you want to test your data against transformations of this.
Since the values "apparently" tend to 0 for t -> -oo and to 1 for t -> +oo, we may restict our search to determine parameters a and b such that 1/(1 + e^(-a*t + b) ) is a good fit.
Note that the outer data points hardly contribute anythin to our knwledge of the curve (they've already fulfilled theiry duty by telling us about the limits as t -> +- oo). The most distinctive part of the curve is near y = 1/2.
The expression  1/(1 + e^(-a*t + b) ) becomes 1/2 exactly when  t = b/a.
The derivative of 1/(1 + e^(-a*t + b) ) at the same point is  a/4.
Hence I suggest you take only thos data point with value between 0.3 and 0.7, say, make a linear degression, i.e. find a best fit line  y = A*t + B.
This line passes through y=1/2 at  t = (1/2 - B)/A with slope A.
Thus a = 4*A and b = 2 - 4*B should give a good fit.

DColinAuthor Commented:
Hi thehagman:

Thank you for your reply. I do not have enough math knowledge to understand your answer fully. Could you please use some examples to illustrate your answer. So for column B if I was supplied the X values of -4 and 8 what would I need to do to predict the Y values (somewhere between 0 and 1) ? thanks.
You are welcome.
Please see attached the modifeied xls file.
I computed the linear approximation using the TREND function in H3 and H4 (as well as I3, I4 for the other set of data points)
Note that the trend is based on the ranges where the measured value are between 0.3 and 0.7, as I said above.
Then I calculate the relevante paramters in the cells below and use these to compute the approximation function in columns D and E.
They fit quite well, I guess.

Of course the original decision to use y values between 0.3 and 0.7 could be altered.
A smaller range would improve the linear fit beacuse the sigmoid is straighter on the smaller range.
On the other hand, a smaller range means less data points and hence more error.


Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now