View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Martin Brown Martin Brown is offline
external usenet poster
 
Posts: 230
Default Using Regression Function in VBA Macro

On 28/05/2014 22:29, Peter T wrote:
"Peter T" wrote in message


I know that's not a 'stressful' test but could you illustrate when Linest
becomes unreliable and/or returns different coeff's to a high precision
chart formula.


Hmm, with a bit more testing I am getting discrepancies between Linest and
the chart formula, but it's the chart formula that's wrong (particularly
with the first x is not increasing from 1), Linest still returning same
coef's as the original formula (with no artificial deviation).


I haven't tested it very recently but normally the chart formula is done
right and LinEst is far too crude to solve it correctly.

You can fix the fault in LinEst by rescaling your problem to control the
condition number so that the x-axis runs from -1 to 1.

The problem arises when people fit a trend against date/time values.
(I don't approve of them fitting high order polynomials to begin with
but if they do it is incumbent on the code to return a true best fit!)

Sample data that shows it should be in the thread

https://groups.google.com/forum/#!search/excel$20polynomial$20fit$20/microsoft.public.excel.worksheet.functions/QWVh_4C2gkA/cyYk3ah6n_kJ

--
Regards,
Martin Brown