Home | News | Documentation | Download

Levenberg-Marquardt Algorithm (GSLMultiFit) - chi-square problem when using SetParLimits

Dear rooters,

I’m struggling with the “GetChisquare” method when using the Levenberg-Marquardth Algorithm for the minimization when I limit a parameter within an certain interval with “SetParLimits”.

Although the fitted curve looks quite nice when plotted, the Chi-square is way to big when compared with TMinuitMinimizer. I’ve realized that without the “SetParLimits” everything looks normal, however I’m fitting a lot of spectra with a given function and I need to limit one of the function parameters, otherwise for some spectra the fit does not converge.

Does anyone knows what may be the reason?

Thank you in advance,

Jorge Machado

Hi,

Do you have a small code example reproducing this problem ?

Lorenzo

Hi,

Not yet. My code is a bit long. I’ll try to reproduce the same problem in a example.

Thanks.

Jorge

To be more clear:

In my analysis I’m fitting real spectra with an interpolation of simulated spectra.
I was able to reproduced my problem in a small example, please find it attached.

If I remove the SetParLimits everything looks ok, or, if instead, I comment the first line and use for the minimization the TMinuitMinimizer. If I run it as it is, I get a Chi-Square of 30646.6 which does not make sense to me.

Thanks.

Jorge Machado

test.C (625 Bytes)

Hi,

Thank you for the example. I can reproduce your problem even with a simple gaussian fit. It seems the returned chi2 value is wrong. If you use the option “V”, you should see the correct value printed. I will investigate the reason for this and try to fix it

Cheers

Lorenzo

Hi,

Thank you very much for your support.
Please let me know if you succeed to correct it.

Cheers,

Jorge Machado

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.