+ Reply to Thread
Results 1 to 14 of 14

Problem with cubic polynomial curve fit calculation ?

  1. #1
    Forum Contributor
    Join Date
    12-26-2005
    Location
    annapolis, Md.
    MS-Off Ver
    2007
    Posts
    260

    Problem with cubic polynomial curve fit calculation ?

    The attached excel program is comprised of 3 spreadsheets ... a linear curve fit, a quadratic fit and a cubic fit.

    The calculated ''y on day x'' value is correct for the linear and the quadratic but is wrong for the cubic [i.e.] it is presented as 1.1089
    but is displayed on the chart as approximately 1.113?

    Please let me know if you see what i am doing wrong.
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with cubic polynomial curve fit calculation ?

    You're only using one significant digit for the x^3 term. Use LINEST instead:

    Row\Col
    A
    B
    C
    D
    E
    2
    date
    daynum
    close
    3
    28-Aug
    1
    1.11800
    4
    31-Aug
    2
    1.12095
    5
    01-Sep
    3
    1.13130
    6
    02-Sep
    4
    1.12255
    7
    03-Sep
    5
    1.11230
    8
    04-Sep
    6
    1.11440
    9
    a3=
    0.000718
    C9:C12: {=TRANSPOSE(LINEST(C3:C8, B3:B8^{1,2,3}))}
    10
    a2=
    -0.009087
    11
    a1=
    0.032088
    12
    a0=
    1.09265
    13
    day num x=
    6
    14
    y on day x=
    1.1131
    C14: =SERIESSUM(C13, 3, -1, $C$9:$C$11) + $C$12
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    12-26-2005
    Location
    annapolis, Md.
    MS-Off Ver
    2007
    Posts
    260

    Re: Problem with cubic polynomial curve fit calculation ?

    Thanks shg,
    Great reply & much appreciated.
    Why is a cubic fit such a big deal, especially given the power & sophistication of Excel?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with cubic polynomial curve fit calculation ?

    You're welcome.

    It's not a big deal at all ...
    Last edited by shg; 09-08-2015 at 11:05 AM.

  5. #5
    Forum Contributor
    Join Date
    12-26-2005
    Location
    annapolis, Md.
    MS-Off Ver
    2007
    Posts
    260

    Re: Problem with cubic polynomial curve fit calculation ?

    i have never experienced the treatment of the form ''x raised to the integer n''
    to be so different for n=2 and n=3.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with cubic polynomial curve fit calculation ?

    Are you referring to the SeriesSum function?

    You could do it as you were previously; it's just more compact and flexible with SeriesSum.
    Last edited by shg; 09-08-2015 at 01:47 PM.

  7. #7
    Forum Contributor
    Join Date
    12-26-2005
    Location
    annapolis, Md.
    MS-Off Ver
    2007
    Posts
    260

    Re: Problem with cubic polynomial curve fit calculation ?

    y = ao + a1*x
    y = ao + a1*x + a2*x^2
    y = ao + a1*x + a2*x^2 + a3*x^3

    i simply wonder why as i progress from quadratic to cubic i
    suddenly must use a different method to correctly compute y?
    [i.e.] why cannot i just simply use the equation y = ao + a1*x + a2*x^2 + a3*x^3?

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with cubic polynomial curve fit calculation ?

    Quote Originally Posted by Joe Miller View Post
    why cannot i just simply use the equation y = ao + a1*x + a2*x^2 + a3*x^3?
    You can. I don't understand what's confusing you.

  9. #9
    Forum Contributor
    Join Date
    12-26-2005
    Location
    annapolis, Md.
    MS-Off Ver
    2007
    Posts
    260

    Re: Problem with cubic polynomial curve fit calculation ?

    per the original post & attachment, I was getting an incorrect y value for the
    cubic solution. your fix [which I blindly applied, having no idea what it does]
    fixed the problem.

    obviously I am unknowingly doing something goofy. i will go back to square one using
    y = a0 + a1*x + a2*x^2 + a3*x^3 and see what happens.

    if you have time, please take another look at the attachment in my original post.

    thanks a lot for your help.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with cubic polynomial curve fit calculation ?

    The problem isn't how you calculate y from the coefficients, it is that you are copying the coefficients as they appear in the trendline equation with the very limited precision with which they are shown.

    All of your fits could be solved in the same way:

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    1
    x^5
    x^4
    x^3
    x^2
    x^1
    b
    2
    date
    daynum
    close
    linear
    -0.00151
    1.12519
    G2:H2: {=LINEST($C$3:$C$8, $B$3:$B$8)}
    3
    28-Aug
    1
    1.118
    quadratic
    -0.00155
    0.00933
    1.11075
    F3:H3: {=LINEST($C$3:$C$8, $B$3:$B$8^{1,2})}
    4
    31-Aug
    2
    1.12095
    cubic
    0.00072
    -0.00909
    0.03209
    1.09265
    E4:H4: {=LINEST($C$3:$C$8, $B$3:$B$8^{1,2,3})}
    5
    01-Sep
    3
    1.1313
    quartic
    0.0008
    -0.01105
    0.04699
    -0.07215
    1.15318
    G5:K5: {=LINEST($C$3:$C$8, $B$3:$B$8^{1,2,3,4})}
    6
    02-Sep
    4
    1.12255
    quintic
    -0.0004
    0.0078
    -0.05669
    0.18423
    -0.25787
    1.2409
    F6:K6: {=LINEST($C$3:$C$8, $B$3:$B$8^{1,2,3,4,5})}
    7
    03-Sep
    5
    1.1123
    8
    04-Sep
    6
    1.1144
    Last edited by shg; 09-08-2015 at 05:20 PM.

  11. #11
    Forum Contributor
    Join Date
    12-26-2005
    Location
    annapolis, Md.
    MS-Off Ver
    2007
    Posts
    260

    Re: Problem with cubic polynomial curve fit calculation ?

    Thanks for the in depth tutorial presentation … much appreciated.
    I have a lot to play with and absorb now but I think I am on the
    way to understanding what you and LINEST are doing.

    My understanding is that a precision of 4 decimal places is insufficient
    coefficient precision … and that LINEST resolves that problem.

    1] Is my understanding correct?
    2] Is there a way to make the trend line equation display more coefficient precision?

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with cubic polynomial curve fit calculation ?

    My understanding is that a precision of 4 decimal places is insufficient
    The number of significant digits is a more significant measure than the number of decimal places.

    and that LINEST resolves that problem.
    Yes, in the sense that it returns the full precision of the result.

    Is there a way to make the trend line equation display more coefficient precision?
    Yes, you can format the trendline label to show the coefficients in scientific notation. Be aware LINEST and chart trendlines are calculated differently, so there may be some differences.
    Last edited by shg; 09-09-2015 at 11:59 AM.

  13. #13
    Forum Contributor
    Join Date
    12-26-2005
    Location
    annapolis, Md.
    MS-Off Ver
    2007
    Posts
    260

    Re: Problem with cubic polynomial curve fit calculation ?

    many thanks. i will try to implement all this info to see if i can make it work.

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Problem with cubic polynomial curve fit calculation ?

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel Formula to regression fit Cubic polynomial
    By vsennak in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-01-2013, 03:21 PM
  2. Polynomial Curve Formula
    By spellstar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-20-2012, 07:20 AM
  3. Replies: 2
    Last Post: 07-09-2012, 11:26 PM
  4. [SOLVED] how do I calculate a polynomial curve fit?
    By Joe Miller in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-22-2012, 07:13 AM
  5. Problems with polynomial curve fitting
    By bertram in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2011, 11:58 PM
  6. Fitting data by a cubic polynomial
    By bhokalivarun in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-04-2009, 06:48 AM
  7. Calculate polynomial curve
    By ronbrosh111 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-06-2006, 01:15 PM
  8. trend for polynomial curve fitting by regressing
    By vijaya in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-11-2005, 11:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1