How to Graph a Distribution for a T-Test

By Luis Olortegui; Updated April 25, 2017
T-distribution is used in statistics for hypothesis testing.

T-distributions are used in statistics to calculate confidence intervals and to test hypotheses. Also called the student T-distribution, this tool was created in 1908, and it helps to calculate statistics with a small sample, or when the data is limited. The mathematics involved in the graph is very complex, making it virtually impossible to graph the distribution without the use of computers. T-distributions have a parameter called degrees of freedom which alter the graph. For academic purposes, we usually show three or more degrees of freedom superimposed on the graph.

Creating the data table for the T-Distribution

Launch Microsoft's Open Office program. Go to cell A1. Enter DOF, which stands for Degrees of Freedom. Write "t" on cell A2, and "Y" on cell B2. Go to cell B1 and write "2", on cell C1 write "4", and "6" on cell D1. Write all these numbers as values.

Go to cell A2. Write " -5 " as a value. Go to cell A3 and enter the formula: " = A2 + 0.2 ". Copy the formula (Ctrl + C), and paste it to the next 50 cells.

Go to cell B3 and enter the formula for the T-distribution: " =(1/ SQRT( $B$1 PI() ) ) * GAMMA( ( $B$1 +1 ) / 2) / GAMMA( $B$1 / 2 ) * POWER( 1+( $A3 $A3/ $B$1 );-5*( $B$1 +1 ) ) "

Copy the cell B3 and paste it on cell C3 and D3. Go to cell C3 and press " F2 " to edit its contents. Replace any references from " $B$1 " to " $C$1 ". Go to cell D3 and change all the references from " $B$1 " to " $D$1. "

Go to cell B3 and select cells B3, D3 and E3. Copy them (Ctrl + C), and paste them in the next 50 cells down.

Creating the Graphs for the Distributions

Go to the " Insert " -> "Chart" menu. Choose the " XY Scatter " type of chart with smooth lines. Click on the " NEXT " button.

Choose the " Data Series " option. Make sure that there are not data series chosen yet. If you find any, click on it and press the " Remove " button.

Click the " Add " button. Click on " X Values " to choose the values for the horizontal axis. Click on the small icon located on the right end of the " X Values " dialog box. Use your mouse to select cells from A3 to A53.

Click on " Y Values " to choose the values on the vertical axis. Click on the small icon on the right end of " Y Values ", and use your mouse to select cells B3 to B53.

Repeat Step 3 (don't forget to click the " Add " button). Repeat Step 4, but instead of selecting cells B3 to B53, choose C3 to C53. Repeat this one more time, replacing the selection from C3 to C53 using D3 to D53 instead. Click " Finish ". You will have three superimposed graphs that match the different degrees of freedom.

Tip

You can also use Excel to create this graph. The formulas will be the same, just the chart options menu will be a little different. If you just need one T-distribution graph, just click the " Finish " after Step 4. You can change the " Degree of Freedom values " (on Row 1), to any value that you need.

Warning

Check the cell on column A that should contain the value zero, " 0 ". On some computers, the calculation is done by iterations and approximations, therefore some computers will not write " 0 "; instead they will output a very small number, which is no good for your calculations.