# P-value from Gaussian test one tail

Hello, i’ve to estimate the p-value and the agreement from a gaussian test at one tail.

I calculated
t= |x0-x1|/sqrt{sigma_x1^2+sigma_x2^2}

now I’ve to calculate the p-value by a gaussian test at one tail. Is there a method by ROOT?

Maybe @moneta you know it?

Thanks

Hi,

To compute the p-value (one-sided) for a gaussian you can use

``````double pvalue = ROOT::Math::normal_cdf_c( x, sigma);
``````

where typically you have `sigma=1`.
For computing the significance given the p-value you can use

``````double z = ROOT::Math::normal_quantile_c(pvalue, sigma=1);
``````

Lorenzo

Hi @moneta thank you

who is x in your formula? maybe is it my t in the formula

?

Hi,

Yes, `x` is your normalised random variable, i.e `t` in your case.
However, since you are defining `t` using the `abs(x0-x1)`, the p-value will be:

``````double pvalue = 2 * ROOT::Math::normal_cdf_c( t, 1.);
``````

Lorenzo

Thank you @moneta last thing

if I use
`double pvalue = 2 * ROOT::Math::normal_cdf_c( t, 1.);`
being t=0.24, I get

``````root [20] double pvalue = 2*ROOT::Math::normal_cdf_c(0.24, 1)
(double) 0.81033026
``````

and the agreement

``````root [21] double z = ROOT::Math::normal_quantile_c(pvalue, 1)
(double) -0.87911396
``````

is it normal that I get a negative value of the number of sigma? (i.e. Nsigma=-0.88)? Or isn’t z the number of sigma?

Hi,
since you are considering the p-value from both tails, for getting the significance you should do:

``````double z = ROOT::Math::normal_quantile_c(pvalue/2., 1);
``````

and you will get again `z=0.24`

Lorenzo

Thank you @moneta

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