# Chisquare evaluation

Hello,

I am Plotting Mass vs probability plot using TGraph. In this i am using same different functions for different ranges of same plot. Lets say for Mass < 50 GeV i am using polynomial of order 5 and for > 50 i am using user defined function ( expo + power) as described “[0] - [1]*TMath::Exp(-(x-[2])/[3]) + [4]*TMath::Power(x,[5])”.

Fitting is nice but i am getting different chisquare/ndf for these two ranges which is quite obvious.

What i want is
a) Single chisquare for whole x range ( for which we need one single function instead of multi functions) but i am unable to find that "single function " which can describe the data file.

b) Any method in which we can use multi functions for different x ranges ( 0-50, 50-1000, 1000-3000) and then finding the single value of chi square instead of by parts chisquare.

Try (depends on what you actually call “chi square”): ```Double_t chi_square_full = chi_square_part_1 + chi_square_part_2 + chi_square_part_3; ``` or: ```Double_t chi_square_full = TMath::Sqrt(chi_square_part_1 * chi_square_part_1 + chi_square_part_2 * chi_square_part_2 + chi_square_part_3 * chi_square_part_3);```
BTW. You can easily write a single C/C++ function which uses different equations in different x ranges.

Thanks @Wile_E_Coyote
Yes , i have written program using the same method as described by you. Your chisquare addition method is same as i was guessing. Is it acceptable to say chi square/ndf (using this method is ) 16/10 for three different functions ( with chi square/ndf for f1 = 10/4 , for f2= 11/3, for f3 = 12/3) ??

This method seems to be doubt full to me…

Maybe: ```Double_t chi_square_over_ndf_full = ( chi_square_over_ndf_part_1 * ndf_part_1 + chi_square_over_ndf_part_2 * ndf_part_2 + chi_square_over_ndf_part_3 * ndf_part_3 ) / ( ndf_part_1 + ndf_part_2 + ndf_part_3 );```

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