Home | News | Documentation | Download

Infinity Chi Squared Value

Hi All,

I’m trying to fit my data using TGraph but the chi squared value I’m getting is 'Inf". What’s the error?

I’ve uploaded all the necessary files.

encount.txt (3.0 KB) [enroot.cpp|attachment]
enroot.cpp (496 Bytes)

Thanks.


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


At zero the fit function diverges. To use the range (limits) you defined in the function, add the “R” option:

 gr->Fit("f1","r");

Thanks @dastudillo for replying! I understand why it is infinity but now when I changed my data to start from x=1 rather than x=0, the fitting is not looking nice. Please see attached.

Well, I suppose it’s just a problem of finding a good fit :slight_smile:

@dastudillo
But why is that by changing x from 0 to 1, the fit goes wrong. In the previous case it was passing nicely through the points but now it’s not?

The output from the first fit said that it failed, so that line was not a proper fit to your function; if that one looked fine, maybe you need to change something in your fit.

@dastudillo The function that I’m using to fit is ‘NKG’ function, a standard function to describe how lateral density varies with core distance. The data points are generated by using a simulation. So I can neither modify the function nor the data points. So what should I change?

Thanks

Sorry, I can’t help on that, maybe someone else can.

No problem. Thanks @dastudillo

Dear chrisbgd,
it seems there is a problem with your simulation, please check it. Normally the simulated data points should be distributed uniformly around the curve of the function, used to generate the points. The figure from your first post shows that points are below the curve at x>50 and x<5, and above the curve at 10<x<40.

This is about modelling physics, not about ROOT.
You really need to discuss it with your supervisor and / or your colleagues.

enroot.cxx (1007 Bytes)

@Wile_E_Coyote I’m sure you must have seen the NKG function. There are actually only 3 parameters in the NKG function Ne, s and rM. In my case, I have directly put the value of rM (moliere radius) instead of taking it as a parameter because it is known for that particular geographical place and that’s why my curve was not coming out right. On the other hand, you’ve taken it as a parameter and it spits out that value for which the curve is fitting well, but the problem now is this value of rM is not correctly matching with the calculated one.
So the question that really needs to be asked is why my simulated points are not generated correctly such that they fit the NKG function for rM=103. It may be due to wrong input of parameters, which I doubt, but needs to be checked.