# Critical Values of the Chi-Square Distribution

I am trying to reproduce the (upper-tail) critical values of chi-square distribution with ν degrees of freedom as reported here. As a test I looked at $\nu=2$ and the probability $0.99$.

As far as I can tell, in Mathematica the ChiSquare distribution is implemented in ChiSquareDistribution, so here is what I tried to do to find the value:

NIntegrate[PDF[ChiSquareDistribution, x], {x, 99/100, Infinity}]

However, this gives 0.609571. Do I need to scale this value to get the desired result?

• Quantile[ChiSquareDistribution, .99] or NSolve[CDF[ChiSquareDistribution, t] == 99/100, t, Reals]? – kglr Dec 1 '17 at 17:33
• InverseCDF[ChiSquareDistribution,99/100] as well. – chuy Dec 1 '17 at 17:45
• Or working from the PDF: FindRoot[Integrate[PDF[ChiSquareDistribution, x], {x, 0, xf}] == 0.99, {xf, 1}] // Quiet or Assuming[xf > 0, Solve[Integrate[PDF[ChiSquareDistribution, x], {x, 0, xf}] == 0.99, xf]] // Quiet – Bob Hanlon Dec 1 '17 at 19:23
• For your question "Do I need to scale this value to get the desired result?", the answer is "No. You've formulated the statement incorrectly to obtain the desired result." To obtain 0.99 you'd need to use NIntegrate[PDF[ChiSquareDistribution, x], {x, 0, 9.21034}]. To obtain the desired value (9.21034) you'd need to follow any of the above comments. – JimB Dec 2 '17 at 1:55

N @ Quantile[ChiSquareDistribution, 99/100]


9.21034

t /.  First@ NSolve[CDF[ChiSquareDistribution, t] == 99/100, t, Reals]


9.21034

Or, modifying the formulation in OP:

t /. First @ NSolve[Integrate[PDF[ChiSquareDistribution, x], {x, 0, t},
Assumptions -> Element[t, Reals]] == 99/100, t, Reals]


9.21034