Problem in use of Minuit

Hello, i’am beginner root user, i’am working on statistical methods for cosmology, we have some parametrized models describing the the components of universe wich we try to estimate theirs parameters using Minuit, i
have analysed three models using the same data then i found the same minimum chi square value for the three models, it’s so weird for me !!! is this possible ?
thank you very much in advance

Hi. Like this is very difficult to say anything. Unless you give more information, ideally the macro you run, will be impossible to say that perhaps the 3 models are indeed the same one.
Cheers,
Pere

thank you very much for your response the three model are different from each other there is an attached file , thank you again.
AMINE
models.C (2.98 KB)

I see several issues with your code. I cannot run it because I obviously need the data for doing the fit. Perhaps ion you could fix them then the problem becomes more clear. In any case, I do not see how you change the model in your macro.

  1. There is a ambiguity between your function called ‘function’ and std::function (notice that you have a using namespace std;). I would rename it to something else.
  2. The signature for the FCN function is wrong. It should be:
void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
  1. The dependency of ‘function’ to the ‘model’ is only on the integral of it. Is the integral really working?
  2. You create a TF1 from the model (and destroy) for each call to ‘function’. I guess this is OK but will be very time consuming.

In fact i wrote a macro for each model i changed the word “function” by “magnetude” to avoid ambiguity and i rewrite the correct form for the fcn function, as in think the integral is calculated without problem , i attached below the macros for each model and the data file, thank very much for your interest
union2.1.txt (21.8 KB)
sab.C (2.71 KB)
LR.C (2.55 KB)
BR.C (2.36 KB)

Until now i’m not able to solve this problem so any help from anybody will be very appreciated thank you in advance.

Hi,

Running your code I see that in the LR.C and BR.C you get very similar results (chi2 minimum values) but not exactly the same. The fit in this case works fine (apart from Minos that I am not sure if you really need it).

The third case has problem computing the integral functions, probably due to problems in the function definitions.

The way you use Minuit is fine. If there is a problem is in your implementation of the functions used to compute the chi square

Best Regards

Lorenzo

thank very much Lorenzo for your response i was working on this problem for all the time i deleted the first part i mean the part multiplied by (1+z)^4 for the models i still have the same value for chi square is i use Minuit correctly if yes why i have all the time the same valus for the models. and please can you review with me the definition of functions

thank very much Lorenzo for your response i was working on this problem for all the time i deleted the first part i mean the part multiplied by (1+z)^4 for the models i still have the same value for chi square is i use Minuit correctly if yes why i have all the time the same valus for the models. and please can you review with me the definition of functions
LR2.C (2.6 KB)
BR2.C (2.19 KB)