# Manually calculate a p-value

## Introduction to calculating a p-value

The p-value is calculated using the test statistic calculated from the samples, the assumed distribution, and the type of test being done.

One way of describing the type of test is by the number of tails.
• For a lower-tailed test, p-value = P(TS < ts | H0 is true) = cdf(ts)
• For an upper-tailed test, p-value = P(TS > ts | H0 is true) = 1 - cdf(ts)
• assuming that the distribution of the test statistic under H0 is symmetric about 0, a two-sided test is specified by: p-value = 2 * P(TS |ts| | H0 is true) = 2 * (1 - cdf(|ts|))
Where:
TermDescription
PProbability of a random variable having a range of values.
TSRandom variable associated with the assumed distribution.
tsThe test statistic calculated from your sample.
cdf()Cumulative density function of the assumed distribution.

Minitab automatically displays p-values for most hypothesis tests. But you can also use Minitab to manually calculate p-values. To manually calculate a p-value in Minitab:

1. Choose:
• Mac: Statistics > Probability Distributions > Cumulative Distribution Function
• PC: STATISTICS > CDF/PDF > Cumulative Distribution Function
2. From Form of input, select A single value.
3. In Value, enter the test statistic.
4. From Distribution, select the appropriate distribution and provide the parameters if necessary.
5. Click OK.
The result is the probability of observing a random variable less than the test statistic, cdf(ts).
• For a lower-tailed test, p-value = cdf(ts)
• For an upper-tailed test, p-value = 1 - cdf(ts)
• For a two-tailed test, p-value = 2 * (1 - cdf(|ts|))

## Example of calculating a lower-tailed p-value

Suppose you do a one-sample lower-tailed z test and the resulting test statistic is -1.785 (ts = -1.785). You want to calculate a p-value for the z-test.

1. Choose:
• Mac: Statistics > Probability Distributions > Cumulative Distribution Function
• PC: STATISTICS > CDF/PDF > Cumulative Distribution Function
2. From Form of input, select A single value.
3. In Value, enter the –1.785.
4. If necessary, in Mean, enter 0 and, in Standard deviation, enter 1.
5. Click OK.

This value is the probability of observing a random variable less than the test statistic, P(TS < -1.785) = 0.0371. Therefore, the p-value = 0.0371.

## Example of calculating an upper-tailed p-value

Now suppose you do a one-sample upper-tailed z test and the resulting test statistic is 1.785 (ts = 1.785). You want to calculate a p-value for the z test.

1. Choose:
• Mac: Statistics > Probability Distributions > Cumulative Distribution Function
• PC: STATISTICS > CDF/PDF > Cumulative Distribution Function
2. From Form of input, select A single value.
3. In Value, enter the 1.785.
4. If necessary, in Mean, enter 0 and, in Standard deviation, enter 1.
5. Click OK.

The results contain the probability of observing a random variable less than your test statistic, P(TS < 1.785) = 0.9629. For an upper-tailed test, you need to subtract this probability from 1. This value is the probability of observing a random variable greater than the test statistic, P(TS > 1.785) = 1 – .9629 = 0.0371. Therefore, the p-value = 0.0371.

###### Note

Because the normal distribution is a symmetric distribution, you could enter –1.785 as the input constant (in step 4). Then, you do not have to subtract the value from 1.

## Example of calculating a two-tailed p-value

Suppose you perform a one-sample two-tailed z test and the resulting test statistic is 1.785 (ts = 1.785). You want to calculate a p-value for the z test.

1. Since the test statistic is positive, calculate an upper-tailed p-value. When the test statistic is negative, calculate a lower-tailed p-value. Click OK.
2. This value is the p-value for a one-tailed test. For a two-tailed test, you need to multiply by this value by 2.

This value is 2 times the probability of observing a random variable greater than the absolute value of the test statistic. 2* P(TS > |1.785|) = 2 * 0.0371 = 0.0742. Therefore, the p-value = 0.0742.

###### Note

Depending on the test or type of data, the calculations do change, but the p-value is usually interpreted the same way.

By using this site you agree to the use of cookies for analytics and personalized content.  Read our policy