# The t-Distribution

Particularly since the t-distribution table is complicated to use, it is helpful to be able to have R do the computation for us. R provides a procedure, `qt`, that behaves much like that table. However, `qt`, given an area, computes a t-value with that area to the left (rather than to the right, as shown in the table).

For a 95% confidence interval, we call `qt` with .975. (Why .975? Because there's 0.025 to the right, and therefore 0.975 to the left.) More generally, we can average the confidence level and 1. Of course, `qt` expects a second parameter, which represents the degrees of freedom. Most generally, we write

```qt(`confidence_level`+1)/2, `df`)
```

For example, to compute t* for a 95% confidence interval with a sample size of 30, we would write

```qt(.975, 29)
```

Similarly, to compute t* for a 90% confidence interval with a sample size of 100, we would write

```qt(.95, 99)
```

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-8 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit `http://creativecommons.org/licenses/by-nc/2.5/` or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.