Fitting a curve to data

Posted on 2011-10-06
Last Modified: 2012-06-21
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
Question by:DColin
    LVL 20

    Expert Comment

    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.


    Author Comment

    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.
    LVL 20

    Accepted Solution

    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

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
    Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now