Auto guessing for user defined fitting function

Hello All,

I would like to know if it is possible to write a function which would provide a user defined fitting function with guesses for its coefficients when it is selected in the fitting window? Stay with me here....

I am in the process of writing a UDF and the success of fitting depends heavily on the initial guesses provided. The problem is that "good guess values" vary greatly from data-set to data-set and I have a lot of data to process which means providing guesses each time will be very time consuming. I can envisage a function which would analyze the data in order to determine coefficient guesses prior to calling the fitting function.

For an over simplified example say we have x-y data in which y is independent of x and equal to some constant value plus some noise. That is I want to fit to data of the form

<br />
Y = constant + noise  <br />


then my fitting function would be something like

<br />
f(x) = 0*x + C<br />


where I want to find C. Now I could find a good starting guess of C by taking the first data value in the y wave or even better by taking the average of the y wave. This could them be supplied to the fitting function.
My problem is more complex than this example but this

Thanks for any help..
You could use something like the Gencurvefit XOP which doesn't not depend at all on the initial guesses provided. Rather, you need to provide upper and lower bounds for each fit parameter, and a differential evolution (Genetic Optimisation) algorithm is applied to minimise the Chi2 value (or any other cost function) you wish to use. Using this kind of fit is more likely to find a global minimum than Levenberg Marquardt. However, it does come at the expense of many more function iterations, which can be a problem if the UDF is expensive.
I have long thought that it would be nice to provide a way for user to write a guessing function that the dialog could call. I haven't implemented it because of the complexity. I also am afraid of the inevitable tech support questions that will arise from folks who can't figure out how to write it.

For now, the only thing I can suggest is that if you can come up with a guessing function, have the function create a coefficient wave which you can subsequently select in the Curve Fit dialog.

And I also happen to know that GenCurveFit is excellent. Typically you would use GenCurveFit to get something quite close to the final solution, then use FuncFit (possibly via the Curve Fit dialog) to polish up the solution.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com