Stat Trek

Teach yourself statistics

Stat Trek

Teach yourself statistics

Hypothesis Test for a Mean

This lesson explains how to conduct a hypothesis test for a mean, using a one-sample z-test or a one-sample t-test.

When to Use This Analysis

The approach described in this lesson is appropriate when the following conditions are met:

Before proceeding with a hypothesis test, ensure that these conditions are met.

When is it normal?

Generally, it is safe to assume the sampling distribution of the mean will be approximately normal in shape when any of the following statements are true.

The Variability of the Sample Mean

To conduct a hypothesis test for a sample mean, we need to know the variability of the sample mean. This means we need to know how to compute the standard deviation of the sampling distribution or the standard error of the sampling distribution.

  • When the standard deviation of the population σ is known, the standard deviation of the sample mean (SD) is:

    SD = σ * sqrt{ ( 1/n ) * ( 1 - n/N ) * [ N / ( N - 1 ) ] }

    where σ is the standard deviation of the population, N is the population size, and n is the sample size. When the population size is much larger (at least 20 times larger) than the sample size, the standard deviation can be approximated by:

    SD = σ / sqrt( n )

  • When the standard deviation of the population σ is unknown, the standard deviation of the sampling distribution cannot be calculated. Under these circumstances, use the standard error. The standard error (SE) can be calculated from the equation below.

    SE = s * sqrt{ ( 1/n ) * ( 1 - n/N ) * [ N / ( N - 1 ) ] }

    where s is the standard deviation of the sample, N is the population size, and n is the sample size. When the population size is much larger (at least 20 times larger) than the sample size, the standard error can be approximated by:

    SE = s / sqrt( n )

Note: In real-world analyses, the standard deviation of the population is seldom known. Therefore, the standard error is used more often than the standard deviation.

Alert

The Advanced Placement Statistics Examination only covers the "approximate" formulas for the standard deviation and standard error.

SD = σ / sqrt( n )

SE = s / sqrt( n )

However, students are expected to be aware of the limitations of these formulas; namely, the approximate formulas should only be used when the population size is at least 20 times larger than the sample size, and when the sampling method is simple random sampling.

General Procedure for Hypothesis Testing

To test any hypothesis, the same five-step procedure is used: (1) state the hypotheses, (2) choose the significance level, (3) compute the test statistic, (4) find the P-value, and (5) interpret results. Here, we apply the general procedure to the hypothesis test of a mean.

State the Hypotheses

Every hypothesis test requires the analyst to state a null hypothesis and an alternative hypothesis . The hypotheses are stated in such a way that they are mutually exclusive. That is, if one is true, the other must be false, as shown below.

  • Null hypothesis (H0): The population mean is equal to M.

    H0: μ = M

  • Alternative hypothesis (Ha): The population mean differs from M in one of three possible ways.

    Ha: μ ≠ M (Two-tailed test checking for any difference)

    Ha: μ > M (One-tailed test checking if μ is greater than M)

    Ha: μ < M (One-tailed test checking if μ is less than M)

where μ is the true population mean and M is the hypothesized population mean.

Choose the Significance Level

Common choices for significance levels are α = 0.05 or α = 0.01, representing the probability of rejecting the null hypothesis when it is true (Type I error).

Compute the Test Statistic

The test statistic will be a z-score or a t-score, depending on sample size and knowledge of the population standard deviation.

Z-Score

If sample size is large (at least 30) and you know the population standard deviation (which is rare), use the one-sample z-test to determine whether the hypothesized population mean differs significantly from the observed sample proportion. The test statistic (z) will be a z-score defined by the following equations:

SD = σ / sqrt( n )

z = (x - M) / SD;

where SD is the standard deviation of the sampling distribution, σ is the population standard deviation, n is sample size, x is the sample mean, and M is the hypothesized population mean (from the null hypothesis).

T-Score

If the population standard deviation is unknown, use the one-sample t-test. The test statistic (t) will be a t-score defined by the following equations:

SE = s / sqrt( n )

t = (x - M) / SE;

where SE is the standard error, s is the sample standard deviation, n is sample size, x is the sample mean, and M is the hypothesized population mean (from the null hypothesis).

The t-score test statistic follows a t-distribution, with degrees of freedom (df) equal to sample size minus one.

Warning: If sample size is small (less than 30) and the population distribution is distinctly not normal (e.g., heavily skewed or contains outliers), neither test is appropriate. In such cases, non-parametric tests may be more appropriate or transformations of the data may be required.

Find the P-Value

The P-value is the probability of observing a sample statistic as extreme as the test statistic. To find the P-value probability for a z-score test statistic, use a standard normal table or a normal distribution calculator. To find the probability for a t-score test statistic, use a t-distribution table or a t-distribution calculator. (See sample problems at the end of this lesson for examples of how this is done with Stat Trek's t-Distribution Calculator.)

Interpret Results

If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null hypothesis. This involves comparing the P-value to the significance level, and rejecting the null hypothesis when the P-value is less than the significance level.

Sample Size Calculator

As you probably noticed, the process of hypothesis testing can be complex. When you need to test a hypothesis about a mean score, consider using the Sample Size Calculator. The calculator is fairly easy to use, and it is free. You can find the Sample Size Calculator in Stat Trek's main menu under the Stat Tools tab. Or you can tap the button below.

Sample Size Calculator

Test Your Understanding

In this section, two sample problems illustrate how to conduct a hypothesis test of a mean score. The first problem involves a two-tailed test; the second problem, a one-tailed test.

Problem 1: Two-Tailed Test

An inventor has developed a new, energy-efficient lawn mower engine. He claims that the engine will run continuously for 5 hours (300 minutes) on a single gallon of regular gasoline. From his stock of 2000 engines, the inventor selects a simple random sample of 50 engines for testing. The engines run for an average of 295 minutes, with a standard deviation of 20 minutes. Test the null hypothesis that the mean run time is 300 minutes against the alternative hypothesis that the mean run time is not 300 minutes. Use a 0.05 level of significance. (Assume that run times for the population of engines are normally distributed.)

Solution: The solution to this problem takes five steps: (1) state the hypotheses, (2) choose the significance level, (3) compute the test statistic, (4) find the P-value, and (5) interpret results. We work through those steps below:

  • State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis.

    Null hypothesis: μ = 300

    Alternative hypothesis: μ ≠ 300

    Note that these hypotheses constitute a two-tailed test. The null hypothesis will be rejected if the sample mean is too big or if it is too small.
  • Choose the significance level. For this analysis, the significance level is 0.05.
  • Compute the test statistic. Because the population standard deviation is unknown, we choose a one-sample t-test for the analysis. Using sample data, we compute the standard error (SE), degrees of freedom (df), and the t-score test statistic (t).

    SE = s / sqrt(n) = 20 / sqrt(50) = 20/7.07 = 2.83

    df = n - 1 = 50 - 1 = 49

    t = (x - M) / SE = (295 - 300)/2.83 = -1.77

    where s is the standard deviation of the sample, x is the sample mean, M is the hypothesized population mean, and n is the sample size.

  • Find the P-value. Since we have a two-tailed test , the P-value is the probability that a t-score having 49 degrees of freedom is more extreme than the absolute value of the test statistic (i.e., less than -1.77 or greater than 1.77). We use the t Distribution Calculator to find P(t < -1.77) is about 0.04.
t-Distribution Calculator
  • Since the t-distribution is symmetric around zero, we know that the P(t < -1.77) equals P(t > 1.77). Thus, the P-value = 0.04 + 0.04 = 0.08.
  • Interpret results. Since the P-value (0.08) is greater than the significance level (0.05), we cannot reject the null hypothesis.

Note: If you use this approach on an exam, you may also want to mention why this approach is appropriate. Specifically, the approach is appropriate because the sampling method was simple random sampling, the population was normally distributed, and the sample size was small relative to the population size (less than 5%).

Problem 2: One-Tailed Test

Bon Air Elementary School has 1000 students. The principal of the school thinks that the average IQ of students at Bon Air is at least 110. To prove her point, she administers an IQ test to 20 randomly selected students. Among the sampled students, the average IQ is 108 with a standard deviation of 10. Based on these results, should the principal accept or reject her original hypothesis? Assume a significance level of 0.01. (Assume that test scores in the population of engines are normally distributed.)

Solution: The solution to this problem takes five steps: (1) state the hypotheses, (2) choose the significance level, (3) compute the test statistic, (4) find the P-value, and (5) interpret results. We work through those steps below:

  • State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis.

    Null hypothesis: μ >= 110

    Alternative hypothesis: μ < 110

    Note that these hypotheses constitute a one-tailed test. The null hypothesis will be rejected if the sample mean is too small.
  • Choose the significance level. For this analysis, the significance level is 0.01
  • Compute the test statistic. Since we do not know the standard deviation of the population, we choose a one-sample t-test for our test method. Using sample data, we compute the standard error (SE), degrees of freedom (df), and the t-score test statistic (t).

    SE = s / sqrt(n) = 10 / sqrt(20) = 10/4.472 = 2.236

    df = n - 1 = 20 - 1 = 19

    t = (x - M) / SE = (108 - 110)/2.236 = -0.894

    where s is the standard deviation of the sample, x is the sample mean, M is the hypothesized population mean, and n is the sample size.

  • Find the P-value. The observed sample mean produced a t statistic test statistic of -0.894. We use the t Distribution Calculator to find P(t < -0.894) is about 0.19.
t-Distribution Calculator
  • This means we would expect to find a sample mean of 108 or smaller in 19 percent of our samples, if the true population IQ were 110. Thus the P-value in this analysis is 0.19.
  • Interpret results. Since the P-value (0.19) is greater than the significance level (0.01), we cannot reject the null hypothesis.