In statistics, we use hypothesis tests to determine whether some claim about a population parameter is true or not.
When we perform a hypothesis test, we often receive a t-score test statistic as a result.
Once we find this t-score test statistic, we can then find the p-value associated with it.
If this p-value is less than a certain value (e.g. 0.10, 0.05, 0.01), then we reject the null hypothesis of the test and conclude that our findings are statistically significant.
The following examples show how to calculate a p-value for a test statistic in Excel in three different scenarios.
Example 1: Calculate P-Value for Two-Tailed Test
Suppose a botanist wants to know if the mean height of a certain species of plant is equal to 15 inches.
In a random sample of 12 plants, she finds that the sample mean height is 14.33 inches and the sample standard deviation is 1.37 inches.
She performs a hypothesis test using the following null and alternative hypotheses:
H0 (Null Hypothesis): μ= 15 inches
HA (Alternative Hypothesis): μ ≠ 15 inches
The test statistic is calculated as:
- t = (x – µ) / (s/√n)
- t = (14.33-15) / (1.37/√12)
- t = -1.694
The degrees of freedom associated with this test statistic is n-1 = 12-1 = 11.
To find the p-value for this test statistic, we will use the following formula in Excel:
=T.DIST.2T(ABS(-1.694), 11)
The following screenshot shows how to use this formula in practice.
The two-tailed p-value is 0.1184.
Since this value is not less than .05, we fail to reject the null hypothesis. We do not have sufficient evidence to say that the mean height of plants is different from 15 inches.
Example 2: Calculate P-Value for Left-Tailed Test
Suppose it’s assumed that the average weight of a certain widget produced at a factory is 20 grams. However, one inspector believes the true average weight is less than 20 grams.
To test this, he weighs a simple random sample of 20 widgets and obtains the following information:
- n = 20 widgets
- x = 19.8 grams
- s = 3.1 grams
He then performs a hypothesis test using the following null and alternative hypotheses:
H0 (Null Hypothesis): μ ≥ 20 grams
HA (Alternative Hypothesis): μ < 20 grams
The test statistic is calculated as:
- t = (x – µ) / (s/√n)
- t = (19.8-20) / (3.1/√20)
- t = -.2885
The degrees of freedom associated with this test statistic is n-1 = 20-1 = 19.
To find the p-value for this test statistic, we will use the following formula in Excel:
=T.DIST(-.2885, 19, TRUE)
The following screenshot shows how to use this formula in practice.
The left-tailed p-value is 0.388044.
Since this value is not less than .05, the inspector fails to reject the null hypothesis. He does not have sufficient evidence to say that the true mean weight of widgets produced at this factory is less than 20 grams.
Note: We used the argument TRUE to specify that the cumulative distribution function should be used when calculating the p-value.
Example 3: Calculate P-Value for Right-Tailed Test
Suppose it’s assumed that the average height of a certain species of plant is 10 inches tall. However, one botanist claims the true average height is greater than 10 inches.
To test this claim, she goes out and measures the height of a simple random sample of 15 plants and obtains the following information:
- n = 15 plants
- x = 11.4 inches
- s = 2.5 inches
She then performs a hypothesis test using the following null and alternative hypotheses:
H0 (Null Hypothesis): μ ≤ 10 inches
HA (Alternative Hypothesis): μ > 10 inches
The test statistic is calculated as:
- t = (x – µ) / (s/√n)
- t = (11.4-10) / (2.5/√15)
- t = 2.1689
The degrees of freedom associated with this test statistic is n-1 = 15-1 = 14.
To find the p-value for this test statistic, we will use the following formula in Excel:
=T.DIST.RT(2.1689, 14)
The following screenshot shows how to use this formula in practice.
The right-tailed p-value is 0.023901.
Since this value is less than .05, the botanist can reject the null hypothesis. She has sufficient evidence to say that the true mean height for this species of plant is greater than 10 inches.
Additional Resources
The following tutorials explain how to perform other common tasks in Excel:
How to Find a P-Value from a Z-Score in Excel
How to Find the P-Value of an F-Statistic in Excel
How to Find the P-Value of a Chi-Square Statistic in Excel