+ Reply to Thread
Results 1 to 7 of 7

trend line equations dont match data

  1. #1
    Registered User
    Join Date
    11-07-2015
    Location
    Adelaide SOuth Australia
    MS-Off Ver
    office 13
    Posts
    4

    trend line equations dont match data

    hi
    i am using the trend line to match a curve and obtain the equation of the curve. it looks like a cubic equation, R^2=0.999 and i get the equation of the line, but when i put x in the equation it does not return the right line but something different

    i tried this on a simple y=mx+c y=5x+6 and it returns R^2 =1, good, but equation of line y=10x+16??????? so it wont match, can anyone tell me what is wrong

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: trend line equations dont match data

    It is difficult without details (and example spreadsheet would go a long way towards helping with this).

    Since we are using the term "trendline", I'm going to assume you are using the chart trendline feature for these regressions, and not the LINEST() function. What chart type are you using -- line or scatter or other? This can be important, because a line chart may very well use different x values in the regression than you think it is using.

    Ultimately, these kind of questions tend to be about knowing exactly what is going into the regression. Can you give us an indication of exactly what is going into the regression?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: trend line equations dont match data

    Quote Originally Posted by RobH1961 View Post
    i am using the trend line to match a curve and obtain the equation of the curve. it looks like a cubic equation, R^2=0.999 and i get the equation of the line, but when i put x in the equation it does not return the right line but something different
    Generally, it is best to use LINEST in the Excel worksheet. But you do not provide sufficient information for us to guide you.

    I suspect you are copying the coefficients displayed in the trendline "label" in a chart. Generally, that will work as well as (sometimes better than!) using LINEST results if you format the trendline label to display constants with 15 significant digits.

    Right-click on the trendline label (which shows the equation and optional R^2); click on Format Trendline Label, Number, Scientific; enter 14 into the Decimal Places field; and click on Close.

    Coefficients appear in a form like 6.28847151515151E+05x. If your x-axis data is in X1:X100, you would interpret that as 6.28847151515151E+05*X1. It is best to copy the coefficient 6.28847151515151E+05 into a cell, and reference the cell in the Excel formulas.

    If you need more guideance, attach an example Excel file using this forum's GUI (press Advanced to see the Attach icon); or upload an example Excel file to a file-sharing website, and post the public/share URL in a response here.

  4. #4
    Registered User
    Join Date
    11-07-2015
    Location
    Adelaide SOuth Australia
    MS-Off Ver
    office 13
    Posts
    4

    Re: trend line equations dont match data

    thanks guys, how do you add a spread sheet

  5. #5
    Registered User
    Join Date
    11-07-2015
    Location
    Adelaide SOuth Australia
    MS-Off Ver
    office 13
    Posts
    4

    Re: trend line equations dont match data

    thanks here is the data, i dont know how to add spreadsheet to post
    4 0.8719
    6 0.4657
    8 0.2737
    10 0.1729
    12 0.1112
    14 0.0758
    so i am trying to get equation of the line, the trendline function used to be the best?

  6. #6
    Registered User
    Join Date
    11-07-2015
    Location
    Adelaide SOuth Australia
    MS-Off Ver
    office 13
    Posts
    4

    Re: trend line equations dont match data

    thanks for telling me how to load sheet
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: trend line equations dont match data

    Quote Originally Posted by RobH1961 View Post
    thanks for telling me how to load sheet
    See Sheet2 in the attached file.

    Your first mistake: you used a Line chart type. That uses {1;2;3;4;5;6} for the x-axis in calculating the trendline instead of the actual data in F5:F10, which is used only for labels for the x-axis.

    Instead, use an XY Scatter chart of some form. I prefer markers only for the data when I am plotting a trendline.

    Second, the trendline label should be formatted to display 15 significant digits in Scientific format, as I described previously.

    We could copy-and-paste each 15-digit coefficient into J1:M1.

    Instead, I demonstrate how to use LINEST for the order-3 polynomial that you chose. Select J1:M1 and array-enter the following formula (press ctrl+shift+Enter instead of just Enter):

    =LINEST(G5:G10,F5:F10^{1,2,3})

    Excel displays the formula surrounded by curly braces. We cannot type the curly braces; that is just how Excel indicates that the formula was array-entered.

    Format J1:M1 as Scientific with 14 decimal places. Note that the coefficients are similar to, but exactly the same as the coefficients in the trendline label. In this case, they are close enough: there are same to 11 or 12 decimal places.

    To compare the actual y-data (G5:G10) with the estimated y-data (H5:H10), enter the following formula into H5 and copy down through H10:

    =SERIESSUM(F5,3,-1,$J$1:$M$1)

    To compare, calculate R^2 with the following formula in J10, formatted as Scientific with 14 decimal places:

    =RSQ(H5:H10,G5:G10)

    Again, note that it is similar to R^2 in the trendline label. In this case, they are the same to 13 decimal places.

    So in this case, you can use LINEST to generate the coefficients.

    But when you are unsure of how to use LINEST for some trendline, or if LINEST fails (as it does, sometimes), you can manually copy-and-paste the trendline label coefficients if they are formatted as Scientific with 14 decimal places.

    Also note that SERIESSUM is useful only for polynomial trendlines. For other trendlines, be sure to use the proper formula in the Excel worksheet.
    Attached Files Attached Files
    Last edited by joeu2004; 11-08-2015 at 02:59 AM. Reason: cosmetic

+ 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. Replies: 2
    Last Post: 10-20-2015, 09:06 AM
  2. Replies: 2
    Last Post: 11-18-2012, 11:20 AM
  3. Excel calculating totally wrong trend line equations
    By exclnoob in forum Excel General
    Replies: 7
    Last Post: 09-27-2012, 06:22 AM
  4. Trend line for multiple data series
    By dimuthu in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-11-2007, 10:57 AM
  5. Find the best trend line as data is entered
    By yuryyuryyury in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-02-2007, 11:08 AM
  6. x-axis dates dont match up with the nodes on the line graph
    By changetires in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-11-2006, 08:50 AM
  7. Idential trend line equations show different trends
    By Wired PSF in forum Excel General
    Replies: 2
    Last Post: 07-26-2006, 11:10 PM

Tags for this Thread

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