Hello, I measured some physics quantities values using 3 different methods then I have the three values, for example one is the ratio of two parameter and I got :
a. 0.692 +/-0.011
b. 0.6833 +/- 0.0053
c. 0.6712 +/- 0.0036
is there an automatic way to calculate the according between the three result (For example how many sigma)?
using namespace ROOT::VecOps;
RVec<float> rv = {0.11, 0.0053, 0.0036};
auto srddev = StdDev(rv);
but
a. Does this methos use only the errors of the results and not the values (0.692, 0.6833, 0.6712)?
b. You see…ROOT closes automatically when I run the
@moneta please, can you check the problem? I resume… I measured physics quantities using 3 instruments…for example for a ratio I got these values (one for each instrument)
a. 0.692 +/-0.011
b. 0.6833 +/- 0.0053
c. 0.6712 +/- 0.0036
I need a test to estimate the according between the 3 results.
I followed your code
No no I meant that RVec::StdDev is dumb, i.e. it does not do anything smart like taking into account error values attached to the inputs
As far as I understand TMath::StdDev does the same by default but it also has an overload that can take into account input weights, you might be able to do something with that.
@eguiraud yes, I understood that you meant the RVec::StdDev is dumb, that’s because I asked to @moneta if there is a better way for my goal!
@moneta: important… I said that I made 3 measurements using three instruments…but I got results using the measurements and making some calucations and fit …
then, for example
a. 0.692 +/-0.011
b. 0.6833 +/- 0.0053
c. 0.6712 +/- 0.0036
are NOT the values read on the instruments, but are results of calculations using the values read by the instruments
Thank you @bellenot I tried to follow the example showed by @dastudillo… but @eguiraud’s code doesn’t look like what I need… I was trying @moneta’s code but you see, I dont’ understand how to apply it…so I hope @moneta can help me, I know he is the most suitable to help regarding on the analysis way using ROOT…
or maybe, also @jblomer could know a way to calculcate the according between the results (because of he works in particle physics)
Hi,
I am not sure I have understood you completly.
You have 3 measurements, and what you would like to know, if they agree to each other ?
If this is the case, it is very simple, you can compute the mean, and compute their chisquared value, from which you can obtained a p-value. To do this, is easier by performing a simple fit with an horizontal line:
{
std::vector<double> x = {1,2,3};
std::vector<double> y = { 0.692, 0.6833, 0.6712 };
std::vector<double> ey = { 0.011, 0.0053, 0.0036};
auto g = new TGraphErrors(3,x.data(),y.data(), nullptr, ey.data());
auto result = g->Fit("pol0","S");
double chi2 = result->Chi2();
double ndf = result->Ndf();
double pvalue = ROOT::Math::chisquared_cdf_c(chi2, ndf);
std::cout << "p value of the fit : " << pvalue << std::endl;
// number of standard sigma. Divide p-value by 2 since deviations can be in both sides
std::cout << "number of sigma is " << ROOT::Math::normal_quantile_c(0.5*pvalue,1) << std::endl;
}
C:\Users\bellenot\rootdev>root
------------------------------------------------------------------
| Welcome to ROOT 6.25/01 https://root.cern |
| (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for win32 on Mar 09 2021, 17:28:03 |
| From heads/master@v6-25-01-74-g202a84bb2e |
| With MSVC 19.24.28319.0 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0] std::vector<double> x = {1,2,3};
root [1] std::vector<double> y = { 0.692, 0.6833, 0.6712 };
root [2] std::vector<double> ey = { 0.011, 0.0053, 0.0036};
root [3] auto g = new TGraphErrors(3,x.data(),y.data(), nullptr, ey.data());
root [4] auto result = g->Fit("pol0","S");
****************************************
Minimizer is Linear / Migrad
Chi2 = 5.78669
NDf = 2
p0 = 0.67618 +/- 0.0028745
root [5] double chi2 = result->Chi2();
root [6] double ndf = result->Ndf();
root [7] double pvalue = ROOT::Math::chisquared_cdf_c(chi2, ndf);
root [8] std::cout << "p value of the fit : " << pvalue << std::endl;
p value of the fit : 0.0553906
root [9] std::cout << "number of sigma is " << ROOT::Math::normal_quantile_c(0.5*pvalue,1) << std::endl;
number of sigma is 1.9158
root [10]
And if you look at the (many) compilation errors with your code, you should be able to fix them. If you want me to try, please provide also the input file.
Thank you @bellenot adding the headers the macro worked on windows too!
@moneta sorry…one more question please…
to quantify the agree between an experimental measurement and the theoretical value, is there some function on ROOT?
For example, the Planck’s constant value is h=6.62607004 *10^-34Js…
I got h=(6.424+/- 0.052)*10^-34 Js
I want to quantify the goodness of the experimental result… is there a function in ROOT?
Thank you