+ Reply to Thread
Results 1 to 8 of 8

Excel calculating totally wrong trend line equations

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    2

    Excel calculating totally wrong trend line equations

    I have a set of data that I plotted using a scatter plot with straight lines in Excel 2010. I added a trend line, made it a 4th degree polynomial, and then used that equation to calculate the data that I used for the plot. I then plotted the calculated data vs. the original data, and while the trend line equations are the same (as they should be), the lines themselves look totally and completely different.

    Take a look at the attached plot.. Excel calculates the trend lines as being the same, even though they obviously are not.

    What gives?
    Attached Images Attached Images

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Excel calculating totally wrong trend line equations

    This would be much easier to diagnose with a copy of the spreadsheet rather than a picture of the chart.

  3. #3
    Registered User
    Join Date
    07-10-2012
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Excel calculating totally wrong trend line equations

    Here you go

    Thanks for your help.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,453

    Re: Excel calculating totally wrong trend line equations

    It looks to me that, like a lot of people, you are using the rounded coefficients as they are currently displayed in the chart. In particular, the x^4 and x^3 coefficients are only to given to one significant figure, and when you use these coefficients rounded to 1 sig fig, you will get very different values than you should.

    I would suggest trying to format the equation so it displays all digits (maybe a number format code of 0.0000000E+0 to get 8 sig figs). Either that or I would suggest using the LINEST function to generate the coefficients to their full precision in the spreadsheet.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Excel calculating totally wrong trend line equations

    The trendlines are not showing enough significant digits to give you an accurate picture. I suggest using LINEST.

    First, create columns for x^2, x^3, and x^4. (I deleted your actual x in col B and used A3:D10 for all the x components)
    Then select 5 cells across columns (I used A28:E28) and enter

    =LINEST($A$17:$A$24,$A$3:$D$10) Enter with CNTRL SHFT ENTER to make it an array formula. Your coefficients will appear in the cells.
    Your formula for the first y value would then be

    =$A$28*A3^4+$B$28*A3^3+$C$28*A3^2+$D$28*A3+$E$28
    Make sense? See attachment
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Forum Contributor
    Join Date
    02-22-2011
    Location
    Rhône Alpes, France
    MS-Off Ver
    Excel 2007
    Posts
    201

    Re: Excel calculating totally wrong trend line equations

    Hi,
    In continuation of the posts and McShorty ChemistB, I enclose a solution using LINEST which allows to calculate any value
    Hope this help
    Best regards
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-27-2012
    Location
    geneva, switzerland
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Excel calculating totally wrong trend line equations

    On MSFT site, it is said that the number formatting of the polynomial function in the graph is not precise enough and that we can correct this by changing the number of decimals. For example in the calculation_trendline_jpr73.xlsm, the function was : y = 1E-07x4 - 0.0001x3 + 0.0587x2 - 10.43x + 867.75
    but in reality it is :
    y = 0.0000000999999999997314x4 - 0.000100000000000026x3 + 0.0586999999998742x2 - 10.4299999999427x + 867.749999993586
    Now what I don't understand is why when we use LINEST we obtain this:
    y= 0.000000137525200690634x4 - 0.000146864975803026x3 + 0.0586512659056951x2 -10.4304873662204x +
    867.747984421906

    I mean it is close but it is not the same. What explains the difference ?

    Thanks in advance

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Excel calculating totally wrong trend line equations

    derik111,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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