Multipeak Fitting Do Fit Recursively


I'm still relatively new to Igor, so apologies if I'm misunderstanding things. As it says in the title, I'm looking to figure out if there's any way to 'Do Fit' until the fit is no longer progressing. I often find that fits can take a long time to progress, which means I have to click the 'Do Fit' button many times to get a satisfactory fit. I almost exclusively use the GUI for this, I'm currently fitting 3 Gaussians to Raman spectra, but when I have to do this many times for each spectra, clicking the 'Do Fit' button so much becomes quite tedious, I'm sure there must be a better way I'm overlooking somewhere. This was previously mentioned in the thread linked here, any advice at all is greatly appreciated, thanks in advance.



Before I answer your question, note that the fit should be 'good enough' with one press of Do Fit. If your fit is progressing significantly when you press the button repeatedly, this is a sign that your fit is not well defined or unstable. If you press the button repeatedly because you still see insignificant movement in your fit then this is just a bad habit, which I can understand very well, however. :)

The wishlist you linked is very old and has been implemented (and much much more) in the meantime. If you have Igor 9 (or at least Igor 8) you should be all set. To 'solve' your issue, click the small arrow next to Options in the fit panel. You should seen the setting 'Fit Converge Tolerance'. Enter a smaller number to let the fit run longer until Multipeak Fit deems the fit done. The lowest possible value is 1e-10, which can make the fit run a few seconds. Note that this does not necessarily improve your fit, especially if the algorithm oscillates around shallow minima.

In reply to by chozo

Hi Chozo,

Thanks for your quick reply! In general my fits tend to make significant progress the first couple times, then settle and make very minor adjustments, quite often oscillating around a central value for a while until eventually the window saying fit no longer progressing pops up. I do understand that this can be indicative of a bad fit, but this unfortunately just seems to be a quirk of the data, I'm following an established method which has yielded meaningful results before, but thanks for checking!

I was hoping that something like that had been implemented, but I wasn't sure where to find it. That works perfecty, thank you! It now only takes 3 or 4 clicks instead of 50+ in extreme cases. 



Without getting a copy of your experiment file, I can't really be sure what the problem might be, but...

The behavior you describe sounds like you have "identifiability" problems. That's statistician-speak for a model where there is significant covariance between some of the fit coefficients, so that the chi-square surface has a very flat-bottomed valley. The solution wanders around the flat bottom looking for the best solution and not finding it. Chances are the reported chi-square doesn't change much while you keep repeating the fit.

You can read more about this in the help: DisplayHelpTopic "Covariance Matrix"

Execute that Igor command to see the help topic about this. Multipeak Fit has the appropriate flag set to save the covariance matrix, so find a wave called "M_covar". Then you can follow the instructions in the Correlation Matrix sub-topic.