[phoenix-project] Re: Expeyes-Junior diode fit fails for LED

  • From: Ambar Chatterjee <drambar@xxxxxxxxx>
  • To: ab <abals@xxxxxxxxxxxxx>
  • Date: Sat, 14 Jan 2017 08:54:15 +0530

*I am commenting on:*





*I think I found the problem:It is the fitting algorithm "leastsq" which is
a "Levenberg-Marquardt" fit, ie least square fit.It does not take advantage
of the knowledge that the funktion is exponential.Instead it sees huge
values for large x and tiny values for small x. In the end the algorithm
has no idea how to vary the parameters in order to find their best values.**The
best approach would be a linear fit of log(y) values*.

*My comment:*
An expert would disagree. Many amateurs are quickly fascinated when they
realise that one can take the logarithm (or another function) along one or
both axes to simplify a fit problem. In fact some problems become linear
when such a transformation is made so that an iterative fit becomes
non-iterative. However the fit after transformation will generally result
in (slightly) different results. What happens is that weight of each point
changes. (A correct fit procedure also takes account of the error on the
points). Levenberg-Marquardt is not least square fit as mentioned above. It
is an iterative *algorithm *that performs least square fit to data and is
used when the functional form is non-linear. It cannot give the absolute
minimum of chi-squared, rather it converges to a local minimum nearest to
the starting values. There are known reasons for its failure or
non-convergence under certain circumstances, The statement "* In the end
the algorithm has no idea how to vary the parameters in order to find their
best values."  *is wrong. The algorithm is general and works, irrespective
of the specific functional form. Instead of taking the log of the y-axis
values, one should include the error bar  (weight=1/error-squared) of each
point in the chi-square definition. It is true that you can get quick and
stable results by taking the logarithm of y-values, but estimation of the
errors on the deduced parameters could not be made correctly. Transforming
the data (especially the logarithmic model) is widely used in the
literature, but in my opinion its better to investigate the failure of
the Levenberg-Marquardt
algorithm in this case.

Best regards
Ambar Chatterjee

Other related posts: