Nonlinear Fitting

cancel
Showing results for 
Search instead for 
Did you mean: 

Nonlinear Fitting Charter and Overview

This group is deals with all aspects of nonlinear fitting in LabVIEW.

(Currently, this document is an early draft. Feel free to join this group and comment and contribute ideas on how this group should be organized. Here are some of my initial thoughts. I will open a discussion later.)

Over the years, I have posted numerous fitting examples in the LabVIEW forum, but there is no common place to keep it all together and keep the examples updated as techniques advance.

The following documents are accepted, but they need to be polished and adhere to my quality guidelines to be defined elsewhere. For each topic there will be an overview document with a summary and linking to all the submitted documents in that group.

Fitting Extensions

Techniques on how to use the stock fitting routines to do specific modifications, especially utilizing the data variant input. We should limit ourselves to a small set of extensions in order to keep the model depository clean and allow easy interchangeability of models.

Some examples:

  • Making the model scalable so it automatically adapts to the number of fitting parameters.
  • Allow the selection (at runtime) of a subset of parameters to be fit, holding the rest constant at the guess value.
  • Allow fitting of higher dimension gridded data (2D array, 3D array, etc)
  • Allow fitting of higher dimension scatter data (e.g.: f1(x1,y1,z1, ...), f2(x2,y2,z2, ...), f3(x3,y3,z3, ...), fN(xN,yN,zN, ...))
  • Allow global fitting of several data sets that share some parameters.
  • Do I really need the x-array (no!).
  • Allow iteractive termination of a slow fit.
  • Allow interactive observation of the fit progress.
  • ...

A model depository

There are many models in science that are common and chances are good that somebody already wrote a model subVI for it. This is the place to share model code.

Models need to be stellar, well documented, and hopefully incorporate a few of the above mentioned extensions as needed.

Each model requires...

  • A concise title containing the most common name for the model.
  • other common names should be listed as keywords.
  • a detailed description of the science and math, and typical uses.
  • Guidelines for picking parameter guesses.
  • a link to a website (e.g. wikipedia, mathworld) tha describes the math behind it (if available).
  • A fully implemented example of a calling VI with good default values that can be run "out of the box" to demonstrate a typical fit.
  • ...

Advanced Topics

Most often, detailed analysis of the problem goes beyond a simple list of best fit parameters. Anything is open for discussion.

  • What does the covariance matrix tell us?
  • Are there multiple minima?
  • How do I pick parameter guesses?
  • How unique is the found solution?
  • How do I know that the result is right?
  • How to spot correlated parameters. How should I display correlation? What do I need to do about it?
  • Can I get an estimate of the error of the best fit parameters? (yes!)
  • Do I always need least squares or are there more appropriate citeria for special cases?
  • Guidelines on how to use weights.
  • What the purpose of the "constrained nonlinear curve fit"?
  • How do I use the "goodness of fit" tool?
  • ...

Alternative algorithms

LabVIEW offers Levenberg-Marquardt, but there are plenty of others. I have written a drop-in replacement that uses Nelder-Mead (sometimes known as simplex) which can have advantages if the partial derivatives are problematic due to the nature of the problem. There are also others such as Monte-Carlo, Differential Evolution (DE) and Genetic Algorithms in general.

Troubleshooting

Common mistakes and how to spot them.

  • Frequently enountered error codes. What do they actually mean and what should I do to correct them?
  • Is the guess parameter array of correct size?
  • Fitting never stops or terminates too early.
  • The fit converges to the wrong solution.
  • All I get back are the initial guesses, why?
  • The found paramters are way off.
Message 1 of 2
(9,159 Views)

During the past few weeks, I have exactly been contemplating along the lines of the topics mentioned by altenbach in advanced topics and alternative algorithms. Are there more people out there who would like to discuss these. Happy to see this document has been mooted. Kudos to altenbach.

0 Kudos
Message 2 of 2
(4,510 Views)