# How to Create a t-Distribution Graph in Excel

A t-distribution is a type of continuous probability distribution. It has the following properties:

• It is continuous
• It is bell-shaped
• It is symmetric around zero
• It is defined by one parameter: the number of degrees of freedom
• The t-distribution converges to the standard normal distribution as the number of degrees of freedom converges to infinity

The t-distribution is often used in various hypothesis tests when sample sizes are small (n < 30) in place of the normal distribution.

## How to Create a t-Distribution Graph in Excel

Often we are interested in visualizing the t-distribution. Fortunately, it’s easy to create a t-distribution graph in Excel by using the T.DIST() function which uses the following syntax:

T.DIST(x, deg_freedom, cumulative)

• x: the value for the random variable in the t-distribution
• deg_freedom: an integer that indicates the number of degrees of freedom in the t-distribution
• cumulative: when set to TRUE, it returns the value for the cumulative density function; when set to FALSE, it returns the value for the probability density function

Next, we’ll show how to create the following t-distribution graph in Excel:

To create a t-distribution graph in Excel, we can perform the following steps:

1. Enter the number of degrees of freedom (df) in cell A2. In this case, we will use 12.

2. Create a column for the range of values for the random variable in the t-distribution. In this case, we will create a range of values from -4 to 4 by increments of 2 in cells B2 through B42.

3. Create a column for the pdf of the t-distribution associated with the random values. In cell C2, type the formula T.DIST(B2, \$A\$2, FALSE). Then hover over the bottom right of cell C2 until the sign appears. Click and drag down to autofill the values for cells C2 through C42.

4. Create the graph. Highlight the two columns (B2:C42). Click the INSERT tab. In the Charts area, click scatter with smooth lines. The following chart will appear:

5. Change the graph appearance. By default, the y-axis appears in the middle of the graph and the gridlines show up in the background. We can change this by using the following steps:

• Right click on the x-axis. Click Format Axis. Under Vertical axis crosses, click Axis Value and type in -5.

• Click inside the chart. A sign will appear in the top right corner. Click it to remove the gridlines (if you’d like) and add axes titles. In this example, we choose to label the x-axis as t, labelthe y-axis as f(t), and remove the title entirely. The picture below shows the end result:

## How to Create Several t-Distribution Graphs in Excel

We can also display several t-distribution curves in one graph if we’d like. This can be useful if we want to see how the shape of the t-distribution changes for various values for the degrees of freedom.

In order to display several t-distribution curves, we simply need to add three new columns for a t-distribution with a different value for the degrees of freedom. For example, we can create t-distribution curves for degrees of freedom = 6 and degrees of freedom = 60:

To create the t-distribution curve for df = 60, we can use the exact same steps we used before. To add a curve for df = 6, we can perform the following steps:

• Right click inside the chart. Click Select Data
• Under Legend Entries (Series), click Edit
• Choose the cells for the X Values and Y Values that contain the values in columns F and G. Then click OK. The following curve will be added to the chart:

You’ll notice a pattern for t-distribution graphs:

• The higher the degrees of freedom, the more narrow the t-distribution curve will be. That is, it will have a higher peak.
• Conversely, the lower the degrees of freedom, the more flattened out the curve will be and the “fatter” the tails of the graph will be.
• As the degrees of freedom approaches infinity, the curve will converge to the standard normal distribution curve.

## Modifying the Aesthetics of the Graph

Note that you can also modify the aesthetics of the graph by changing the following features:

• Modify the size and color of the title
• Modify the size and color of the axes labels
• Choose whether or not to display gridlines in the background
• Modify the background color of the graph
• Modify the color of the curve itself
• Choose whether or not to display the tick marks along the axes

Depending on how you would like the graph to appear, Excel gives you the ability to modify the chart quite a bit.

Find more Excel tutorials on Statology here.

## 2 Replies to “How to Create a t-Distribution Graph in Excel”

1. Brad Quiring (Bus. Stats Prof.) says:

Hi Zach,

I found this entry extremely helpful. Thank you. I’d like to use this Excel t-distribution to teach confidence intervals. I’ve been trying to figure out how to superimpose two dynamic vertical lines for the lower and upper limits of the interval estimates but can’t quite figure how to get Excel to do this. Any insights would be greatly appreciated.

1. James Carmichael says:

Hi Brad…To superimpose two dynamic vertical lines on a t-distribution chart in Excel for teaching confidence intervals, you can use the following steps:

1. **Prepare Your Data:**
– Ensure you have your t-distribution data and the corresponding x-values (degrees of freedom) in two columns.
– Identify or calculate your lower and upper confidence interval limits based on your sample data.

2. **Create the T-Distribution Chart:**
– Select your t-distribution data.
– Go to the “Insert” tab and select a scatter plot (with smooth lines) to create the t-distribution chart.

3. **Add Dynamic Vertical Lines:**
– Add two additional columns next to your t-distribution data for the lower and upper confidence limits. Let’s assume the t-distribution x-values are in column A and the y-values are in column B, and the lower and upper limits are in cells D1 and E1, respectively.

| A | B | C | D |
|———|———|————|————–|
| X-values| Y-values| Lower Limit| Upper Limit |
| … | … | D1 | E1 |

4. **Create Data for Vertical Lines:**
– In column C, add the x-values of your lower limit. In column D, add the x-values of your upper limit. For simplicity, let’s assume you want to use the same range of y-values for the vertical lines.

| A | B | C | D |
|———|———|————|————–|
| X-values| Y-values| Lower Limit| Upper Limit |
| … | … | =D\$1 | =E\$1 |

5. **Plot Vertical Lines:**
– Select the chart, and go to the “Chart Tools” in the “Design” tab.
– Click on “Select Data.”
– Add a new series for the lower limit:
– Name the series “Lower Limit.”
– Set the X values to the column with the lower limit (e.g., C).
– Set the Y values to the range of y-values you want to plot the vertical line.
– Add a new series for the upper limit:
– Name the series “Upper Limit.”
– Set the X values to the column with the upper limit (e.g., D).
– Set the Y values to the range of y-values you want to plot the vertical line.

6. **Format the Vertical Lines:**
– Click on each series for the vertical lines and format them to be lines instead of scatter points.
– Right-click the series, select “Change Series Chart Type,” and choose a line chart for these series.

7. **Make the Lines Dynamic:**
– The lines will now be dynamic and adjust according to the values in cells D1 and E1. You can link these cells to your confidence interval calculations, making the vertical lines automatically adjust when the confidence interval limits change.

Here is a step-by-step example in Excel to visualize it:

1. **Enter the Data:**
– Assume column A has x-values, column B has y-values of your t-distribution.
– Cell D1 has the lower limit (e.g., -1.96), and cell E1 has the upper limit (e.g., 1.96).

2. **Enter Values for Vertical Lines:**
– In column C, enter `=D\$1` for each corresponding y-value row.
– In column D, enter `=E\$1` for each corresponding y-value row.

3. **Select Data for Chart:**
– Highlight columns A and B to create the initial t-distribution chart.
– Add series for the lower and upper limits by selecting columns C and D for the x-values, and your chosen y-values range for the y-values.

4. **Adjust Chart Type:**
– Change the series chart type for the lower and upper limits to lines.

This approach ensures that the vertical lines representing the confidence interval limits adjust dynamically based on the values you input, making it a powerful teaching tool for demonstrating confidence intervals with the t-distribution.