scikit-hep/iminuit

cost.LeastSquares for multidimensional data

jaromrax opened this issue · 3 comments

Hello,
thank you for your work on iminuit,

I wonder, if the LeastSquares function can handle multidimensional data.
Manual says something about support of multidimensional data, however, it is not clear
to me how to fit several histograms at once.

The example - I want to fit 16+ (binned) histograms containing a gaussian peak + background,
where sigma and position is a common for all, area and background may change.

My attempts like ( LeastSquares( (x1,x2,..),(y1,y2,...) ... ) were not successful.

Thank you very much
Jaro

The illustration may show the importance :
Screenshot from 2022-07-19 16-00-46

It looks like you want to share parameters between otherwise independent fits. This is different from fitting a parametric model to the multi-dimensional data.

Examples of fitting multi-dimensional histograms can be found here https://iminuit.readthedocs.io/en/stable/notebooks/cost_functions.html

Examples of doing fits with shared parameters can be found here https://iminuit.readthedocs.io/en/stable/notebooks/simultaneous_fits.html

For binned data, you should prefer ExtendedBinnedNLL over LeastSquares unless you know that the bin contents are not Poisson-distributed.

Since issues are for reporting errors in iminuit or suggesting new features, I am closing this, but feel free to contact me on Gitter (see README.rst).