# Formula or procedure for computing standard statistical tables such as z table, Student's t-table, or chi-square table

How can the following tables be computed:

• Chi-Square table
• Student t-table

I'm looking for a formula or procedure used to make these tables.

### For example:

If I have a given 'x'-value, as df(degree of freedom) with some confidence percentage 'y', I should be able to plug these x and y values into that formulae or procedure and should get results close to that in the standard tables.

I'm pretty sure that there is some logic behind these tables, but I could not find any concrete pointers. how to reach them. My guess, about some logic got surety when I found some tool doing this online: http://faculty.vassar.edu/lowry/csqsamp.html

• Just to reemphasize what others have already alluded to, it is generally much preferred to rely on standard packages and software for computing such things. A lot of the algorithms and code have decades worth of thought and maintenance associated with them. It's certainly worthwhile to understand how they arise mathematically and even some of the details behind the numerical implementation. But, similar to numerical linear algebra, I'd highly discourage anyone from attempting to roll their own implementation. Commented Apr 30, 2011 at 13:49

On e.g. wikipedia you can find the formula for the cdf / pdf of these distributions. Enter the values of the parameters and you're done.

If you want the reverse (I think you do from your question), simplest 'general' way of getting it done (not all cdfs have an analytic inverse) is use a univariate solver.

Maybe you could just use R, that holds all these functions...

• +1 R is a good suggestion. Be very careful about using software not specifically created for mathematical or statistical calculation! In particular, do not use Excel--it makes mistakes--and do not rely on Web apps.
– whuber
Commented Apr 29, 2011 at 13:49
• I'm trying to look into it, and will let you know. Thank you Nick. Commented Apr 29, 2011 at 14:16
• I have some that I did in Excel so my students could use them. I also have just a simple spreadsheet that you put the alpha/confidence value in, add degrees of freedom, and get the required value. Email me at zbicyclist at yahoo dot com Note whuber's comment -- Excel will work for standard values likely to be see in an introductory course, but will flop if you go beyond them -- e.g. z score of 8. Commented Apr 29, 2011 at 16:33

I would look into a few special functions, which continually "pop-up" in statistics - often in disguised forms:

1. the confluent hypergeometric function $_{1}F_{1}(a;b;z)$. heaps of functions are special cases of this one, such as erf, incomplete gamma, bessel.
2. the incomplete gamma function (and regularised incomplete gamma function)
3. the incomplete beta function (and regularised incomplete beta function)
4. Gaussian hypergeometric function $_{2}F_{1}(a;b;c;z)$

2) and 3) are the CDFs for chi-square and t-distributions for certain values of the parameters. I would invert these using the table backwards, rather than directly looking for an inverse function. It is likely that the error in interpolation (for sufficiently close values) may be less than the error in numerically evaluating a complicated inverse function.

• In general, I would be cautious about using "general" special functions like $_1F_1$ for these types of numerics. In fact, it's quite hard to find a really good implementation of $_1F_1$, for example. The more specialized functions do just fine and have received much more attention from the numerical-analysis and algorithms community. Commented Apr 30, 2011 at 13:44