1
$\begingroup$

How are t-quantiles and $\chi^2$-quantiles actually calculated? I find it difficult to find a formula.

For example, the t-quantile for 0.975 and 50 degrees of freedom is approximately 2.

This is easy to find out if I look it up in a table or use software. But how is it calculated?

When I try to figure it out by searching, I always end up on a page describing that it has something to do with one's data set, but that must be something else than what I'm looking for, since the quantiles are always the same and has nothing to do with one's data set.

$\endgroup$
  • 1
    $\begingroup$ Please see stackoverflow.com/q/27912412 for a discussion of the algorithms used for "qt" function (inverse t) in R, as well as related algorithms used in R and MATLAB. $\endgroup$ – Just_to_Answer Aug 5 '17 at 17:53
  • $\begingroup$ For some reason, I can't make the formula on the page you linked to evaluate to approximately 2, when I insert the numbers related to my example. Could you show me how it is done? $\endgroup$ – A. Jakobsen Aug 5 '17 at 18:39
  • 1
    $\begingroup$ If you are referring to using the qt function in R, its basic inputs are p and the df. So for example, qt(0.975, df=50) on the R console gives me 2.008559 $\endgroup$ – Just_to_Answer Aug 5 '17 at 18:52
  • 1
    $\begingroup$ The wikipedia link en.wikipedia.org/wiki/… computations only apply for DF up to 4. For higher df, it will be insane (or impossible) to compute by hand. $\endgroup$ – Just_to_Answer Aug 5 '17 at 19:07
  • 1
    $\begingroup$ But just in terms of checking for fun, for df=2, qt(0.975, df=2) gives 4.302653 matching up with 2*(.975-.5)*sqrt(2/(4*0.975*(1-0.975))) giving 4.302653 $\endgroup$ – Just_to_Answer Aug 5 '17 at 19:08
0
$\begingroup$

The PDFs and CDFs of Student's t and chi-squared distributions are known and are displayed in the corresponding Wikipedia articles. The PDFs are shown in appendixes of many intermediate probability and mathematical statistics courses. Your specific questions involve use of the quantile functions (inverse CDFs). In principle, methods of numerical integration can be used to get probabilities from PDFs. Also, mathematical methods can be used to invert CDFs for the same purpose.

An important computational difficulty is that the PDFs and CDFs of Student's t and chi-squared distributions are expressed in terms of gamma functions, which must also be evaluated by numerical methods.

You are correct that printed tables give results for Student's t distributions that arise in most practical applications--and for chi-squared distributions in many practical applications. Statistical software packages (SAS, Minitab, SPSS, R, and so on) have functions that give a wider range of quantiles than you will find in tables. Statistical calculators and Excel give useful approximations.

Chapter 26 of Abramowitz and Stegen (PDF file available online) catalogues some rational approximations that give reasonable accuracy over various ranges of parameters. However, these are less frequently used nowadays because it is easy to get more accurate results from software. (Some software functions use carefully vetted rational approximations, but generally more intricate and accurate ones than you will find in A&S.)

$\endgroup$
  • $\begingroup$ So in other words, it is actually a quite complex task to calculate the quantiles by hand? Without any software etc. $\endgroup$ – A. Jakobsen Aug 5 '17 at 19:04
  • $\begingroup$ Precisely. If there were simple formulas, publishers would not find the space for tables of t and chi-squared distributions. Even standard normal is not easy, maybe see my list of methods to evaluate $P(0 < Z < 1)$ here. $\endgroup$ – BruceET Aug 5 '17 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.