A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

6th order polynomial equ yields unexpected results



 
 
Thread Tools Display Modes
  #1  
Old September 22nd, 2005, 01:41 PM
Sanjay Kumar Limbikai
external usenet poster
 
Posts: n/a
Default 6th order polynomial equ yields unexpected results

Hi,

If I evaluate my 6th order poly equation in Excell, it yields unexpected
results, but the eq works well for 1 to 5th order polynomial trend chart.
is there another way to work with 6th order poly eq. Any help would be
highly appreciated.

Thanks
Sanjay Limbikai
  #2  
Old September 22nd, 2005, 05:30 PM
Tushar Mehta
external usenet poster
 
Posts: n/a
Default

Check if you should even be using a 6th order polynomial.

See the 'Over-specifying a regression' section in
Trendline coefficients
http://www.tushar-mehta.com/excel/ti...efficients.htm

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2005

In article ,
says...
Hi,

If I evaluate my 6th order poly equation in Excell, it yields unexpected
results, but the eq works well for 1 to 5th order polynomial trend chart.
is there another way to work with 6th order poly eq. Any help would be
highly appreciated.

Thanks
Sanjay Limbikai

  #3  
Old September 23rd, 2005, 11:51 AM
Jerry W. Lewis
external usenet poster
 
Posts: n/a
Default

You have given far too little information for us to be able to
accurately diagnose.

What version of Excel?
How are you fitting the polynomial? (chart trendline equation, LINEST,
other?)
What unexpected results are you getting?
Is the data set small enough that you could reasonably include it in
your post? (body text, no attachments, please)

While it is quite likely that you are over-fitting the data (as Tushar
suggested), it is not clear how that, in and of itself, would produce
"unexpected results". If you are using LINEST in versions prior to
Excel 2003, you could easily be in terretory where LINEST's algorithm
has numerical difficulties (how do coefficient estimates compare with
the chart trendline coefficients? [which is much better numerically]).
LINEST in Excel 2003 is much better numerically than previous versions,
but coefficients that are exactly zero are not to be trusted (again, how
do they compare to the chart trendline coefficients?). If you are using
the chart trendline coefficients and copying them into a worksheet for
further calculation, did you obtain them to full precision (format the
chart equation element to scientific notation with 14 decimal places) or
did you copy the heavily rounded values that Excel displays by default?

Jerry

Sanjay Kumar Limbikai wrote:

Hi,

If I evaluate my 6th order poly equation in Excell, it yields unexpected
results, but the eq works well for 1 to 5th order polynomial trend chart.
is there another way to work with 6th order poly eq. Any help would be
highly appreciated.

Thanks
Sanjay Limbikai


  #4  
Old September 24th, 2005, 05:57 AM
Sanjay Kumar Limbikai
external usenet poster
 
Posts: n/a
Default

Sorry for confusing you,

Here it is more-
Excell 2002,
I was comparing coefficients with extracting using LINEST function to the
constants of displayed trend eq (6th order) with full precission. They are
all different.

Thanks for your valuable information.
Sanjay Limbikai

"Jerry W. Lewis" wrote:

You have given far too little information for us to be able to
accurately diagnose.

What version of Excel?
How are you fitting the polynomial? (chart trendline equation, LINEST,
other?)
What unexpected results are you getting?
Is the data set small enough that you could reasonably include it in
your post? (body text, no attachments, please)

While it is quite likely that you are over-fitting the data (as Tushar
suggested), it is not clear how that, in and of itself, would produce
"unexpected results". If you are using LINEST in versions prior to
Excel 2003, you could easily be in terretory where LINEST's algorithm
has numerical difficulties (how do coefficient estimates compare with
the chart trendline coefficients? [which is much better numerically]).
LINEST in Excel 2003 is much better numerically than previous versions,
but coefficients that are exactly zero are not to be trusted (again, how
do they compare to the chart trendline coefficients?). If you are using
the chart trendline coefficients and copying them into a worksheet for
further calculation, did you obtain them to full precision (format the
chart equation element to scientific notation with 14 decimal places) or
did you copy the heavily rounded values that Excel displays by default?

Jerry

Sanjay Kumar Limbikai wrote:

Hi,

If I evaluate my 6th order poly equation in Excell, it yields unexpected
results, but the eq works well for 1 to 5th order polynomial trend chart.
is there another way to work with 6th order poly eq. Any help would be
highly appreciated.

Thanks
Sanjay Limbikai



  #5  
Old September 26th, 2005, 03:18 AM
Jerry W. Lewis
external usenet poster
 
Posts: n/a
Default

Two possibilities depending on the type of chart you used:

- "Line" chart: The chart is likely not doing what you intended. A
"Line" chart is misleadingly named and has nothing to do with whether
you want points joined by a line or not. A trendline on a "Line" chart
uses x-values of 1,2,3,... regardless of the x-values that you may have
specified. Consequently, the the polynomial trendline from a "Line"
chart is probably meaningless.

- "X-Y (Scatter)" chart: The x-values do not span a wide enough range
of values for LINEST to be able to estimate the coefficients accurately.
The algorithm used by the chart trendline is more robust. If you post
the data (text in body of post; no attachments, please) then I could
comment on the accuracy (or possible inaccuracy) of the chart coefficients.

Jerry

Sanjay Kumar Limbikai wrote:

Sorry for confusing you,

Here it is more-
Excell 2002,
I was comparing coefficients with extracting using LINEST function to the
constants of displayed trend eq (6th order) with full precission. They are
all different.

Thanks for your valuable information.
Sanjay Limbikai

"Jerry W. Lewis" wrote:


You have given far too little information for us to be able to
accurately diagnose.

What version of Excel?
How are you fitting the polynomial? (chart trendline equation, LINEST,
other?)
What unexpected results are you getting?
Is the data set small enough that you could reasonably include it in
your post? (body text, no attachments, please)

While it is quite likely that you are over-fitting the data (as Tushar
suggested), it is not clear how that, in and of itself, would produce
"unexpected results". If you are using LINEST in versions prior to
Excel 2003, you could easily be in terretory where LINEST's algorithm
has numerical difficulties (how do coefficient estimates compare with
the chart trendline coefficients? [which is much better numerically]).
LINEST in Excel 2003 is much better numerically than previous versions,
but coefficients that are exactly zero are not to be trusted (again, how
do they compare to the chart trendline coefficients?). If you are using
the chart trendline coefficients and copying them into a worksheet for
further calculation, did you obtain them to full precision (format the
chart equation element to scientific notation with 14 decimal places) or
did you copy the heavily rounded values that Excel displays by default?

Jerry

Sanjay Kumar Limbikai wrote:


Hi,

If I evaluate my 6th order poly equation in Excell, it yields unexpected
results, but the eq works well for 1 to 5th order polynomial trend chart.
is there another way to work with 6th order poly eq. Any help would be
highly appreciated.

Thanks
Sanjay Limbikai



  #6  
Old September 26th, 2005, 11:06 AM
Sanjay Kumar Limbikai
external usenet poster
 
Posts: n/a
Default

Hello Jerry,

Here is the data

Date Data Points
01/01/1976 3138
01/01/1976 3247
08/18/1977 3163
01/30/1978 3185
04/01/1978 3014
07/01/1978 3199
07/07/1978 3116
10/30/1978 3185
01/18/1979 3074

Though this is the first few records of my data,
I used to draw a chart of poly trend line of 6th order (Excell2002),
and used to extract constants - =LINEST(B2:B10,A2:A10^{1,2,3,4,5,6})
the coefficients are different as of trend line equ.

Sanjay



"Jerry W. Lewis" wrote:

Two possibilities depending on the type of chart you used:

- "Line" chart: The chart is likely not doing what you intended. A
"Line" chart is misleadingly named and has nothing to do with whether
you want points joined by a line or not. A trendline on a "Line" chart
uses x-values of 1,2,3,... regardless of the x-values that you may have
specified. Consequently, the the polynomial trendline from a "Line"
chart is probably meaningless.

- "X-Y (Scatter)" chart: The x-values do not span a wide enough range
of values for LINEST to be able to estimate the coefficients accurately.
The algorithm used by the chart trendline is more robust. If you post
the data (text in body of post; no attachments, please) then I could
comment on the accuracy (or possible inaccuracy) of the chart coefficients.

Jerry

Sanjay Kumar Limbikai wrote:

Sorry for confusing you,

Here it is more-
Excell 2002,
I was comparing coefficients with extracting using LINEST function to the
constants of displayed trend eq (6th order) with full precission. They are
all different.

Thanks for your valuable information.
Sanjay Limbikai

"Jerry W. Lewis" wrote:


You have given far too little information for us to be able to
accurately diagnose.

What version of Excel?
How are you fitting the polynomial? (chart trendline equation, LINEST,
other?)
What unexpected results are you getting?
Is the data set small enough that you could reasonably include it in
your post? (body text, no attachments, please)

While it is quite likely that you are over-fitting the data (as Tushar
suggested), it is not clear how that, in and of itself, would produce
"unexpected results". If you are using LINEST in versions prior to
Excel 2003, you could easily be in terretory where LINEST's algorithm
has numerical difficulties (how do coefficient estimates compare with
the chart trendline coefficients? [which is much better numerically]).
LINEST in Excel 2003 is much better numerically than previous versions,
but coefficients that are exactly zero are not to be trusted (again, how
do they compare to the chart trendline coefficients?). If you are using
the chart trendline coefficients and copying them into a worksheet for
further calculation, did you obtain them to full precision (format the
chart equation element to scientific notation with 14 decimal places) or
did you copy the heavily rounded values that Excel displays by default?

Jerry

Sanjay Kumar Limbikai wrote:


Hi,

If I evaluate my 6th order poly equation in Excell, it yields unexpected
results, but the eq works well for 1 to 5th order polynomial trend chart.
is there another way to work with 6th order poly eq. Any help would be
highly appreciated.

Thanks
Sanjay Limbikai




  #7  
Old September 26th, 2005, 11:42 AM
Martin Brown
external usenet poster
 
Posts: n/a
Default

Sanjay Kumar Limbikai wrote:

Sorry for confusing you,

Here it is more-
Excell 2002,
I was comparing coefficients with extracting using LINEST function to the
constants of displayed trend eq (6th order) with full precission. They are
all different.


Almost certainly the solution shown by the graphical chart polynomial is
a better fit than the one from LINEST. The simplest way to test this is
to compute the polynomial fit out for all your datapoints and then
explicitly sum up the squares of the residuals in a spreadsheet model.

Whichever one has more nearly minimised the sum of the squares is best.

Prior to Excel 2003 LINEST is potentially suspect on anything more
complex than a cubic polynomial for some nasty datasets. You might be
able to get better agreement between the two fits by using days since
1/1/1976 as the x variable (dates have a huge additive constant in
them). It should help improve the numerical stability of the problem a bit.

Regards,
Martin Brown
  #8  
Old September 26th, 2005, 01:25 PM
Jerry W. Lewis
external usenet poster
 
Posts: n/a
Default

This Least Squares problem is ridiculously difficult numerically.
Dedicated statistics packages will refuse to do it at all, unless you
first orthogonalize the predictors yourself.

Excel dates are stored as the number of days since 1900, so the numeric
values in column A are

27760, 27760, 28355, 28520, 28581, 28672, 28678, 28793, 28873

which has a coefficient of variation (relative standard deviation)
1.5%. Consequently the condition number of X'X for solving the normal
equations is 3E+80, which means that Excel would potentially need
between 5 and 6 times its actual precision for LINEST to reliably
recognize that X'X is invertable.

Correct coefficients are (to 15 digits; obtained algebraically in Maple)

1.13729790060870E+15 (intercept)
-2.39465281115860E+11 (x)
2.10079765828648E+07 (x^2)
-9.82899962202329E+02 (x^3)
2.58667425348765E-02 (x^4)
-3.63042771974839E-07 (x^5)
2.12298835919803E-12 (x^6)

From this, you can see that chart coefficients are accurate to around
4 figures on this problem (which indicates just how good the chart
algorithm is). LINEST in Excel 2003 gives about 3 figure accuracy.

Jerry

Sanjay Kumar Limbikai wrote:

Hello Jerry,

Here is the data

Date Data Points
01/01/1976 3138
01/01/1976 3247
08/18/1977 3163
01/30/1978 3185
04/01/1978 3014
07/01/1978 3199
07/07/1978 3116
10/30/1978 3185
01/18/1979 3074

Though this is the first few records of my data,
I used to draw a chart of poly trend line of 6th order (Excell2002),
and used to extract constants - =LINEST(B2:B10,A2:A10^{1,2,3,4,5,6})
the coefficients are different as of trend line equ.

Sanjay


  #9  
Old September 26th, 2005, 01:25 PM
Tushar Mehta
external usenet poster
 
Posts: n/a
Default

If you plot the data you will quickly see that the only trend is a flat
horizontal line or, with the application of a fair dose of imagination,
a slight downward sloping trend.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hello Jerry,

Here is the data

Date Data Points
01/01/1976 3138
01/01/1976 3247
08/18/1977 3163
01/30/1978 3185
04/01/1978 3014
07/01/1978 3199
07/07/1978 3116
10/30/1978 3185
01/18/1979 3074

Though this is the first few records of my data,
I used to draw a chart of poly trend line of 6th order (Excell2002),
and used to extract constants - =LINEST(B2:B10,A2:A10^{1,2,3,4,5,6})
the coefficients are different as of trend line equ.

Sanjay



"Jerry W. Lewis" wrote:

Two possibilities depending on the type of chart you used:

- "Line" chart: The chart is likely not doing what you intended. A
"Line" chart is misleadingly named and has nothing to do with whether
you want points joined by a line or not. A trendline on a "Line" chart
uses x-values of 1,2,3,... regardless of the x-values that you may have
specified. Consequently, the the polynomial trendline from a "Line"
chart is probably meaningless.

- "X-Y (Scatter)" chart: The x-values do not span a wide enough range
of values for LINEST to be able to estimate the coefficients accurately.
The algorithm used by the chart trendline is more robust. If you post
the data (text in body of post; no attachments, please) then I could
comment on the accuracy (or possible inaccuracy) of the chart coefficients.

Jerry

Sanjay Kumar Limbikai wrote:

Sorry for confusing you,

Here it is more-
Excell 2002,
I was comparing coefficients with extracting using LINEST function to the
constants of displayed trend eq (6th order) with full precission. They are
all different.

Thanks for your valuable information.
Sanjay Limbikai

"Jerry W. Lewis" wrote:


You have given far too little information for us to be able to
accurately diagnose.

What version of Excel?
How are you fitting the polynomial? (chart trendline equation, LINEST,
other?)
What unexpected results are you getting?
Is the data set small enough that you could reasonably include it in
your post? (body text, no attachments, please)

While it is quite likely that you are over-fitting the data (as Tushar
suggested), it is not clear how that, in and of itself, would produce
"unexpected results". If you are using LINEST in versions prior to
Excel 2003, you could easily be in terretory where LINEST's algorithm
has numerical difficulties (how do coefficient estimates compare with
the chart trendline coefficients? [which is much better numerically]).
LINEST in Excel 2003 is much better numerically than previous versions,
but coefficients that are exactly zero are not to be trusted (again, how
do they compare to the chart trendline coefficients?). If you are using
the chart trendline coefficients and copying them into a worksheet for
further calculation, did you obtain them to full precision (format the
chart equation element to scientific notation with 14 decimal places) or
did you copy the heavily rounded values that Excel displays by default?

Jerry

Sanjay Kumar Limbikai wrote:


Hi,

If I evaluate my 6th order poly equation in Excell, it yields unexpected
results, but the eq works well for 1 to 5th order polynomial trend chart.
is there another way to work with 6th order poly eq. Any help would be
highly appreciated.

Thanks
Sanjay Limbikai





  #10  
Old September 26th, 2005, 02:46 PM
Jerry W. Lewis
external usenet poster
 
Posts: n/a
Default

Since the OP is comparing LINEST with the chart trendline, he must have
already plotted the data. On the assumption that he actually looked at
the plot that he produced, I can only assume that he is interested in
the numerics of the fitting process, not the quality (or lack thereof)
of this particular fit.

Jerry

Tushar Mehta wrote:

If you plot the data you will quickly see that the only trend is a flat
horizontal line or, with the application of a fair dose of imagination,
a slight downward sloping trend.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an Orders Form with multiple order types Brook Using Forms 5 March 31st, 2005 02:19 PM
Disappearing results Gilley Mailmerge 1 August 21st, 2004 12:12 PM
Query in datasheet view yields different results than opening it as a recordset Jason Seaver Running & Setting Up Queries 3 July 7th, 2004 05:00 PM
Adding auto-numbered field screws up Table order Carl Database Design 5 May 30th, 2004 03:25 AM
Excel Subtotal Yields Blank Results Mark Worksheet Functions 0 October 8th, 2003 03:49 AM


All times are GMT +1. The time now is 06:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.