PC Review


Reply
Thread Tools Rate Thread

6th order polynomial equ yields unexpected results

 
 
=?Utf-8?B?U2FuamF5IEt1bWFyIExpbWJpa2Fp?=
Guest
Posts: n/a
 
      22nd Sep 2005
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
 
Reply With Quote
 
 
 
 
Tushar Mehta
Guest
Posts: n/a
 
      22nd Sep 2005
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 <213A64AE-C48A-4F40-9B1B-(E-Mail Removed)>,
(E-Mail Removed) 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
>

 
Reply With Quote
 
Jerry W. Lewis
Guest
Posts: n/a
 
      23rd Sep 2005
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


 
Reply With Quote
 
=?Utf-8?B?U2FuamF5IEt1bWFyIExpbWJpa2Fp?=
Guest
Posts: n/a
 
      24th Sep 2005
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

>
>

 
Reply With Quote
 
Jerry W. Lewis
Guest
Posts: n/a
 
      26th Sep 2005
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
>>>

>>


 
Reply With Quote
 
=?Utf-8?B?U2FuamF5IEt1bWFyIExpbWJpa2Fp?=
Guest
Posts: n/a
 
      26th Sep 2005
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
> >>>
> >>

>
>

 
Reply With Quote
 
Martin Brown
Guest
Posts: n/a
 
      26th Sep 2005
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
 
Reply With Quote
 
Jerry W. Lewis
Guest
Posts: n/a
 
      26th Sep 2005
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


 
Reply With Quote
 
Tushar Mehta
Guest
Posts: n/a
 
      26th Sep 2005
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 <32E6656B-ECEC-4948-A0E7-(E-Mail Removed)>,
(E-Mail Removed) 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
> > >>>
> > >>

> >
> >

>

 
Reply With Quote
 
Jerry W. Lewis
Guest
Posts: n/a
 
      26th Sep 2005
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SkidPrice(G, 48.000,120.000) yields unexpected results Gina Whipp Microsoft Access 3 1st Mar 2006 03:48 PM
SkidPrice(G, 48.000,120.000) yields unexpected results Gina Whipp Microsoft Access Form Coding 3 1st Mar 2006 03:48 PM
SkidPrice(G, 48.000,120.000) yields unexpected results Gina Whipp Microsoft Access Queries 3 1st Mar 2006 03:48 PM
8th Order Polynomial Trend - Is there an easy way? Frank & Pam Hayes Microsoft Excel Programming 0 7th Oct 2004 12:53 AM
Trendlines - 6th order polynomial Jonathan Microsoft Excel Misc 2 17th Sep 2003 01:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:20 PM.