Error function and Gauss Probability Distribution Function

Dear All,

I’d like to get the area under the probability density function. As you know, there is a Z value table to read the probability or area under its curve. I attach here. Also, there area some well known values that I put here.
Where am I doing wrong so that the pre-defined error function in ROOT doesn’t give me the result? Later, please tell me about how to get the error, too.

That’s my result on my terminal: This should be 0.68268, namely 68.268%.



Try:

ROOT::Math::erf(1. / TMath::Sqrt2()) /* (chi / sqrt(2)) */
ROOT::Math::erf(2. / TMath::Sqrt2()) /* (chi / sqrt(2)) */
ROOT::Math::erf(3. / TMath::Sqrt2()) /* (chi / sqrt(2)) */

and / or:

ROOT::Math::chisquared_cdf((1. * 1.), 1.) /* (chi^2, ndf) */
ROOT::Math::chisquared_cdf((2. * 2.), 1.) /* (chi^2, ndf) */
ROOT::Math::chisquared_cdf((3. * 3.), 1.) /* (chi^2, ndf) */

1 Like

Alright, that’s good. Thanks for that, but what was wrong with the error function idea or code! That’s what I am curious about.

Try:

{
  TF1 *f = new TF1("f", "ROOT::Math::erf(x)", -5., 5.);
  f->Draw();
  gPad->SetGrid(1, 1);
}

What they call “erf(x)” in the “Table 1.1” and equations “(1.6)”, “(1.7)” and “(1.8)” is:
ROOT::Math::erf(x / TMath::Sqrt2()) / 2.
and / or:
ROOT::Math::chisquared_cdf((x * x), 1.) / 2.

1 Like

I see. I was expecting the code will work without any addition just like saying erf(1) in the formula. It seems we need to add those sqrt stuff due to how it was defined.

What is chi, btw? Is it defined in ROOT menu? Any link.

Cheers.

Wikipedia → Chi-squared distribution
Wolfram MathWorld → Chi-Squared Distribution

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