Errors in fitting prameters

Hi all,

One question.....When fitting is performed, Igor gives back the tabulated results where all peak parameters (location, height, area and FWHM) are given with their respective errors. As far as i understand these +/- errros values are calculated by the diagonal elements of the covariance matrix. My problem is that when i fit a Voigt function i get a huge error for the height value. Error values in location and area are sensible, but for the height they are very big (156 +/- 152 for example). Does anybody know what could cause this? Just to say that there is no problem when Lorentzian or Gaussian fitting is used. Thanks very much.

King regards
You are not helping by only giving limited information.
Can you post an example, or report all the fit parameters with their errors?

I suspect that (at least) one of the other fit parameters also has a large error - sometimes two fit parameters can 'fight' each other, especially if there are not many data points in the fit. One could consider that the parameters are correlated in some way. These two parameters can end up with both having large errors even though the result is a 'good' fit.

Here is a very silly example that illustrates this point:
Function myFitFun(w,x) : FitFunc
    Wave w
    Variable x

    //CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will
    //CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog.
    //CurveFitDialog/ Equation:
    //CurveFitDialog/ f(x) = A1*x^(E1) + A2*x^(E2)
    //CurveFitDialog/ End of Equation
    //CurveFitDialog/ Independent Variables 1
    //CurveFitDialog/ x
    //CurveFitDialog/ Coefficients 4
    //CurveFitDialog/ w[0] = A1
    //CurveFitDialog/ w[1] = A2
    //CurveFitDialog/ w[2] = E1
    //CurveFitDialog/ w[3] = E2

    return w[0]*x^(w[2]) + w[1]*x^(w[3])
End

Make/O/D/N=10 myData
myData = 10*x^(0.5) + 5*x^(0.8) + gnoise(2)
Display myData
ModifyGraph mode=3,rgb=(0,12800,52224)

Make/D/N=4/O W_coef
W_coef[0] = {10,10,0.5,0.5}
FuncFit/NTHR=0/TBOX=768 myFitFun W_coef  myData /D


This gives the following fit results:
K0 =7.0846 ± 1.16e+005
K1 =7.884 ± 1.16e+005
K2 =0.62906 ± 102
K3 =0.63018 ± 93.4
Yet the plot of the fit looks sensible.

Hope this helps,
Kurt
Hi Kurt,

I am posting two screenshots of two different voigt fittings. The one called ''large error'' shows what i described in my previous post.....You can from the residuals that the fitting looks good and also the errors for the other parameters are reasonable. However, the error for the amplitude is huge. Any ideas? I am also uploading another screenshot of the second voigt fitting where you can see an error value which seems to be negative....-25.....This also seems weird but i can not understand the reason. Any thoughts would be much appreciated. Thanks a lot.
Konstantinos Chatzipanagis wrote:
You can from the residuals that the fitting looks good and also the errors for the other parameters are reasonable. However, the error for the amplitude is huge. Any ideas?


I cannot reproduce your issue as you have not provided an example that anyone else can experiment with. Can you double check that all the other parameters have small error values? - they are off screen in your screen shot.

Konstantinos Chatzipanagis wrote:
I am also uploading another screenshot of the second voigt fitting where you can see an error value which seems to be negative....-25.....This also seems weird but i can not understand the reason.


I rarely use MultipeakFit, and I do not understand the negative error value. Hopefully someone else can help with this?

Sorry I cannot help any more.
Regards,
Kurt
''I cannot reproduce your issue as you have not provided an example that anyone else can experiment with. Can you double check that all the other parameters have small error values? - they are off screen in your screen shot''

i think you can see in the screenshot the error for the location and area as well (just on their right side with the +/-)....they seem quite sensible! For the FWHM parameter there is no available value from Igor. Would you have any ideas or somebody else maybe?

There does seem to be some kind of error or inconsistency in the Voigt results reported in the MPF2 package. If you scroll to the right in the results window, you'll find a "height" parameter that is similar to the "amplitude" parameter but has a much more reasonable error associated with it. In that window, if you click "Report in Notebook" the inconsistency is more obvious. See the attached screenshot from my test.

I'd suggest using the "height" parameter rather than "amplitude." But beyond that, I'd suggest avoiding the (pseudo-)Voigt peak shape for detailed error estimates, since it has many parameters and isn't necessarily analytical or well-grounded in a physical model.
VoigtMPF.png
Thank you so much for your effort.....maybe you are right and this is why a lot of people avoid to use the voigt profile in general due to its complexity. One more thing that i wanted to ask....i see from your screen shot that the values for ''ampltitude'' and ''height'' are very close together.....in some of these fittings that i showed these values are very different in my case.....Is this sensible? Many thanks
The Voigt lineshape is a convolution of a Lorentzian peak with a Gaussian peak. I work with x-ray photoelectron spectroscopy, and the intrinsic shape of an XPS peak is Lorentzian due to the lifetime of the core hole. However, the instruments we use to measure XPS peaks with have a finite resolution and give rise to a Gaussian broadening of the signal, producing a Voigt peak shape. This is often approximated by a pseudo-Voigt peak which is the sum or product of a Lorentzian peak with a Gaussian peak. The pseudo-Voigt shape is used because it is much more easier to calculate. The Voigt shape is therefore grounded in a physical model, but you should never use a more complicated peak shape than you have to. For noisy data I will often use a simple Gaussian, despite the fact that the true shape should be a Voigt. Your peak looks like you could fit it with a pure Lorentzian.
Your pictures don't include the Shape parameter. Your data look like they are very nearly pure Lorenzian. Any time the Shape parameter is very small or very large (nearly pure Gaussian or nearly pure Lorenzian) the Voigt fit will be unstable.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
johnweeks wrote:
Any time the Shape parameter is very small or very large (nearly pure Gaussian or nearly pure Lorenzian) the Voigt fit will be unstable.


Is that a general property of the Voigt function or an issue with the approximation used in Igor?

Last time I had to implement Voigt in C++ I used


An algorithm for the numerical computation of the Voigt function, F.G. Lether, P.R. Wenston, Applied Mathematics and Computation, Volume 35, Issue 3, February 1990, Pages 277-289


although nowadays I probably would try http://apps.jcns.fz-juelich.de/doku/sc/libcerf or http://www.boost.org/doc/libs/1_63_0/boost/math/special_functions/erf.h… first.
thomas_braun wrote:
johnweeks wrote:
Any time the Shape parameter is very small or very large (nearly pure Gaussian or nearly pure Lorenzian) the Voigt fit will be unstable.


Is that a general property of the Voigt function or an issue with the approximation used in Igor?


I have only ever used pseudo-Voigt peaks, but a true Voigt peak would probably have separate widths of the Gaussian and Lorentzian components. It makes sense that if the Gaussian width is very narrow the measured peak would become almost pure Lorentzian, and it will no longer be possible to determine the width of the Gaussian other than to say it must be mush smaller than the width of the Lorentzian. That's probably another reason to use pseudo-Voigt peaks.
I expect it would apply to any Voigt fit. When the ratio of the widths is extreme, changing the width of the one that is disappearing will have little effect on the shape of the peak. That leads to derivatives that are very near zero, which causes numerical instability.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com