Iterative Curve Fitting in IGOR

Hello, I am trying to write a procedure for minimizing the sum of differences for 2 data sets (experimental and model): min||Σi λi * x(t)i – y(t)||. I understand to fit a model (x) to a dataset (y) we can use IGOR's built-in curve fitting function. I have read the manual on this section but don't understand how to go about executing an iterative curve fit (I have never done this type of analysis before). Any help or direction to examples would be appreciated.

Thank you,
Stephanie
Maybe I don't understand your question. I think you are asking about something that Igor does when curve fitting. Igor does iterations of the fit to get to the lowest chi squared value for the fit. So you don't need a procedure at all, you just need to define a user function, plug in some sensible guesses and let Igor do the rest.
sjr51 wrote:
Maybe I don't understand your question. I think you are asking about something that Igor does when curve fitting. Igor does iterations of the fit to get to the lowest chi squared value for the fit. So you don't need a procedure at all, you just need to define a user function, plug in some sensible guesses and let Igor do the rest.


So in the Curve Fitting dialogue box, I create a New Fit Function (which in my case is something like f(x)=lambda*x-y) and give an initial guess as to what lambda is?
Yes, but that will get you a least squares fit, not a least absolute difference fit. After you have used the dialog, you will see the generated FuncFit command and a report on the fit. This next bit is a bit arcane and kind of an outdated style, but...

On the command line create a global variable and set its value with this command:
Variable V_FitOptions=2
Now click the FuncFit command and press Enter to copy the command to the command line. Press Enter again the execute the command. Now the fit will use least absolute error instead of least squared error. From the documentation on this technique:
Quote:

Bit 1: Robust Fitting
You can get a form of robust fitting where the sum of the absolute deviations is minimized rather than the squares of the deviations, which tends to de-emphasize outlier values. To do this, create V_FitOptions and set bit 1 (Variable V_fitOptions=2). Warning 1: No attempt to adjust the results returned for the estimated errors or for the correlation matrix has been made. You are on your own. Warning 2: Don't set this bit and then forget about it. Warning 3: Setting Bit 1 has no effect on line, poly or poly2D fits.

On your other post, I recommended Optimize for your problem. This technique with FuncFit may be easier for you. Neither method will get you proper errors on the result. For that, you probably need to use some technique like Bootstrap, which will be quite difficult.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com