Section 2 - Hypothesis Testing
Section 2 - Hypothesis Testing
In the previous section, we developed statistical methods, primarily in the form of confidence intervals, for answering the question "what is the value of
the parameter ?" In this section, we'll learn how to answer a slightly different question, namely "is the value of the parameter such and such?" For
example, rather than attempting to estimate , the mean body temperature of adults, we might be interested in testing whether , the mean body
temperature of adults, is really 37 degrees Celsius. We'll attempt to answer such questions using a statistical method known as hypothesis testing.
We'll derive good hypothesis tests for the usual population parameters, including:
a population mean
the difference in two population means, , say
a population variance
a population proportion
the difference in two population proportions, , say
three (or more!) means, , and , say
We'll also work on deriving good hypothesis tests for the slope parameter of a least-squares regression line through a set of data points, as
well as the corresponding population correlation coefficient .
We'll start our exploration of hypothesis tests by focusing on population proportions. Specifically, we'll derive the methods used for testing:
Thereby allowing us to test whether two populations' proportions are equal. Along the way, we'll learn two different approaches to hypothesis testing,
one being the critical value approach and one being the -value approach.
Every time we perform a hypothesis test, this is the basic procedure that we will follow:
Let's try to make this outlined procedure more concrete by taking a look at the following example.
Example 9-1
https://online.stat.psu.edu/stat415/book/export/html/887 1/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
A four-sided (tetrahedral) die is tossed 1000 times, and 290 fours are observed. Is there evidence to conclude that the die is biased, that is, say, that
more fours than expected are observed?
Answer
As the basic hypothesis testing procedure outlines above, the first step involves stating an initial assumption. It is:
Assume the die is unbiased. If the die is unbiased, then each side (1, 2, 3, and 4) is equally likely. So, we'll assume that p, the probability of getting a 4 is
0.25.
In general, the initial assumption is called the null hypothesis, and is denoted . (That's a zero in the subscript for "null"). In statistical notation, we
write the initial assumption as:
That is, the initial assumption involves making a statement about a population proportion.
Now, the second step tells us that we need to collect evidence (data) for or against our initial assumption. In this case, that's already been done for us.
We were told that the die was tossed times, and fours were observed. Using statistical notation again, we write the collected
evidence as a sample proportion:
Now we just need to complete the third step of making the decision about whether or not to reject our initial assumption that the population
proportion is 0.25. Recall that the Central Limit Theorem tells us that the sample proportion:
follows a standard normal distribution. So, we can "translate" our observed sample proportion of 0.290 onto the scale. Here's a picture that
summarizes the situation:
0.25 0.290
2.92
So, we are assuming that the population proportion is 0.25 (in blue), but we've observed a sample proportion 0.290 (in red) that falls way out in the
right tail of the normal distribution. It certainly doesn't appear impossible to obtain a sample proportion of 0.29. But, that's what we're left with
deciding. That is, we have to decide if a sample proportion of 0.290 is more extreme that we'd expect if the population proportion does indeed equal
0.25.
1. one is called the "critical value" (or "critical region" or "rejection region") approach
2. and the other is called the " -value" approach
Until we get to the page in this lesson titled The -value Approach, we'll use the critical value approach.
https://online.stat.psu.edu/stat415/book/export/html/887 2/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
Example (continued)
A four-sided (tetrahedral) die is tossed 1000 times, and 290 fours are observed. Is there evidence to conclude that the die is biased, that is, say, that
more fours than expected are observed?
Answer
Okay, so now let's think about it. We probably wouldn't reject our initial assumption that the population proportion if our observed sample
proportion were 0.255. And, we might still not be inclined to reject our initial assumption that the population proportion if our observed
sample proportion were 0.27. On the other hand, we would almost certainly want to reject our initial assumption that the population proportion
if our observed sample proportion were 0.35. That suggests, then, that there is some "threshold" value that once we "cross" the threshold
value, we are inclined to reject our initial assumption. That is the critical value approach in a nutshell. That is, critical value approach tells us to define
a threshold value, called a "critical value" so that if our "test statistic" is more extreme than the critical value, then we reject the null hypothesis.
Let's suppose that we decide to reject the null hypothesis in favor of the "alternative hypothesis" if:
or equivalently if
0.05
0.25 0.273
1.645
Note, by the way, that the "size" of the critical region is 0.05. This will become apparent in a bit when we talk below about the possible errors that we
can make whenever we conduct a hypothesis test.
At any rate, let's get back to deciding whether our particular sample proportion appears to be too extreme. Well, it looks like we should reject the null
hypothesis (our initial assumption ) because:
Our conclusion: we say there is sufficient evidence to conclude , that is, that the die is biased.
By the way, this example involves what is called a one-tailed test, or more specifically, a right-tailed test, because the critical region falls in only one
of the two tails of the normal distribution, namely the right tail.
Before we continue on the next page at looking at two more examples, let's revisit the basic hypothesis testing procedure that we outlined above. This
time, though, let's state the procedure in terms of performing a hypothesis test for a population proportion using the critical value approach. The
basic procedure is:
1. State the null hypothesis and the alternative hypothesis . (By the way, some textbooks, including ours, use the notation instead of
to denote the alternative hypothesis.)
2. Calculate the test statistic:
3.
https://online.stat.psu.edu/stat415/book/export/html/887 3/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
5. Make a decision. Determine if the test statistic falls in the critical region. If it does, reject the null hypothesis. If it does not, do not reject the null
hypothesis.
Now, back to those possible errors we can make when conducting such a hypothesis test.
Possible Errors
So, argh! Every time we conduct a hypothesis test, we have a chance of making an error. (Oh dear, why couldn't I have chosen a different profession?!)
1. If we reject the null hypothesis (in favor of the alternative hypothesis ) when the null hypothesis is in fact true, we say we've committed a
Type I error. For our example above, we set P(Type I error) equal to 0.05:
0.25 0.273
1.645
Aha! That's why the 0.05! We wanted to minimize our chance of making a Type I error! In general, we denote the
"significance level of the test." Obviously, we want to minimize . Therefore, typical values are 0.01, 0.05, and 0.10.
2. If we fail to reject the null hypothesis when the null hypothesis is false, we say we've committed a Type II error. For our example, suppose
(unknown to us) that the population proportion is actually 0.27. Then, the probability of a Type II error, in this case, is:
Let's take a look at two more examples of a hypothesis test for a single proportion while recalling the hypothesis testing procedure we outlined on the
previous page:
4. Make a decision. Determine if the test statistic falls in the critical region. If it does, reject the null hypothesis. If it does not, do not reject the null
hypothesis.
The first example involves a hypothesis test for the proportion in which the alternative hypothesis is a "greater than hypothesis," that is, the alternative
hypothesis is of the form . And, the second example involves a hypothesis test for the proportion in which the alternative hypothesis is a
"less than hypothesis," that is, the alternative hypothesis is of the form .
https://online.stat.psu.edu/stat415/book/export/html/887 4/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
Example 9-2
Let p equal the proportion of drivers who use a seat belt in a state that does not have a mandatory seat belt law. It was claimed that . An
advertising campaign was conducted to increase this proportion. Two months after the campaign, out of a random sample of drivers
were wearing seat belts. Was the campaign successful?
Answer
Because we're interested in seeing if the advertising campaign was successful, that is, that a greater proportion of people wear seat belts, the
alternative hypothesis is:
α = 0.01
Z
2.326
That is, we reject the null hypothesis if the test statistic . Because the test statistic falls in the critical region, that is, because
, we can reject the null hypothesis in favor of the alternative hypothesis. There is sufficient evidence at the level to
conclude the campaign was successful ( ).
Again, note that this is an example of a right-tailed hypothesis test because the action falls in the right tail of the normal distribution.
https://online.stat.psu.edu/stat415/book/export/html/887 5/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
Example 9-3
A Gallup poll released on October 13, 2000, found that 47% of the 1052 U.S. adults surveyed classified themselves as "very happy" when given the
choices of:
"very happy"
"fairly happy"
"not too happy"
Suppose that a journalist who is a pessimist took advantage of this poll to write a headline titled "Poll finds that U.S. adults who are very happy are in
the minority." Is the pessimistic journalist's headline warranted?
Answer
Because we're interested in the majority/minority boundary line, the null hypothesis is:
Because the journalist claims that the proportion of very happy U.S. adults is a minority, that is, less than 0.50, the alternative hypothesis is:
Now, this time, we need to put our critical region in the left tail of the normal distribution. If we use a significance level of , then the critical
region is:
α = 0.05
Z
-1.645
That is, we reject the null hypothesis if the test statistic . Because the test statistic falls in the critical region, that is, because
, we can reject the null hypothesis in favor of the alternative hypothesis. There is sufficient evidence at the level to
conclude that , that is, U.S. adults who are very happy are in the minority. The journalist's pessimism appears to be indeed warranted.
Note that this is an example of a left-tailed hypothesis test because the action falls in the left tail of the normal distribution.
https://online.stat.psu.edu/stat415/book/export/html/887 6/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
Example 9-4
Up until now, we have used the critical region approach in conducting our hypothesis tests. Now, let's take a look at an example in which we use what
is called the P-value approach.
Among patients with lung cancer, usually, 90% or more die within three years. As a result of new forms of treatment, it is felt that this rate has been
reduced. In a recent study of n = 150 lung cancer patients, y = 128 died within three years. Is there sufficient evidence at the level, say, to
conclude that the death rate due to lung cancer has been reduced?
Answer
and
α = 0.05
P
0.90
Z
-1.645 0
Since the test statistic Z = −1.92 < −1.645, we reject the null hypothesis. There is sufficient evidence at the level to conclude that the rate has
been reduced.
https://online.stat.psu.edu/stat415/book/export/html/887 7/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
What if we set the significance level = P(Type I Error) to 0.01? Is there still sufficient evidence to conclude that the death rate due to lung cancer has
been reduced?
Answer
In this case, with , the rejection region is Z ≤ −2.33. That is, we reject if the test statistic falls in the rejection region defined by Z ≤ −2.33:
α = 0.01
P
0.90
Z
-2.33 0
Because the test statistic Z = −1.92 > −2.33, we do not reject the null hypothesis. There is insufficient evidence at the level to conclude that
the rate has been reduced.
In the first part of this example, we rejected the null hypothesis when . And, in the second part of this example, we failed to reject the null
hypothesis when . There must be some level of , then, in which we cross the threshold from rejecting to not rejecting the null hypothesis.
What is the smallest that would still cause us to reject the null hypothesis?
Answer
We would, of course, reject any time the critical value was smaller than our test statistic −1.92:
https://online.stat.psu.edu/stat415/book/export/html/887 8/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
Z
-2.33 -1.645 0
-1.92
That is, we would reject if the critical value were −1.645, −1.83, and −1.92. But, we wouldn't reject if the critical value were −1.93. The
associated with the test statistic −1.92 is called the P-value. It is the smallest that would lead to rejection. In this case, the P-value is:
So far, all of the examples we've considered have involved a one-tailed hypothesis test in which the alternative hypothesis involved either a less than
(<) or a greater than (>) sign. What happens if we weren't sure of the direction in which the proportion could deviate from the hypothesized null value?
That is, what if the alternative hypothesis involved a not-equal sign (≠)? Let's take a look at an example.
What if we wanted to perform a "two-tailed" test? That is, what if we wanted to test:
versus
at the level?
Answer
Let's first consider the critical value approach. If we allow for the possibility that the sample proportion could either prove to be too large or too
small, then we need to specify a threshold value, that is, a critical value, in each tail of the distribution. In this case, we divide the "significance level"
by 2 to get :
Z
-1.96 0 1.96
That is, our rejection rule is that we should reject the null hypothesis or we should reject the null hypothesis .
Alternatively, we can write that we should reject the null hypothesis . Because our test statistic is −1.92, we just barely fail to reject the
null hypothesis, because 1.92 < 1.96. In this case, we would say that there is insufficient evidence at the level to conclude that the sample
proportion differs significantly from 0.90.
Now for the P-value approach. Again, needing to allow for the possibility that the sample proportion is either too large or too small, we multiply the
P-value we obtain for the one-tailed test by 2:
https://online.stat.psu.edu/stat415/book/export/html/887 9/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
0.0274 0.0274
Z
-1.92 0 1.92
Because the P-value 0.055 is (just barely) greater than the significance level , we barely fail to reject the null hypothesis. Again, we would say
that there is insufficient evidence at the level to conclude that the sample proportion differs significantly from 0.90.
Let's close this example by formalizing the definition of a P-value, as well as summarizing the P-value approach to conducting a hypothesis test.
P-Value
The P-value is the smallest significance level that leads us to reject the null hypothesis.
Alternatively (and the way I prefer to think of P-values), the P-value is the probability that we'd observe a more extreme statistic than we did if
the null hypothesis were true.
If the P-value is small, that is, if , then we reject the null hypothesis .
Note!
By the way, to test , some statisticians will use the test statistic:
One advantage of doing so is that the interpretation of the confidence interval — does it contain ? — is always consistent with the hypothesis test
decision, as illustrated here:
Answer
Two-tailed test. In this case, the critical region approach tells us to reject the null hypothesis against the alternative hypothesis
:
if or if
if or if
https://online.stat.psu.edu/stat415/book/export/html/887 10/58
3/16/25, 12:23 AM Section 2: Hypothesis Testing
which is equivalent to rejecting the null hypothesis:
if or if
That's the same as saying that we should reject the null hypothesis is not in the confidence interval!
Left-tailed test. In this case, the critical region approach tells us to reject the null hypothesis against the alternative hypothesis
:
if
if
if
That's the same as saying that we should reject the null hypothesis is not in the upper confidence interval:
So far, all of our examples involved testing whether a single population proportion p equals some value . Now, let's turn our attention for a bit
towards testing whether one population proportion equals a second population proportion . Additionally, most of our examples thus far have
involved left-tailed tests in which the alternative hypothesis involved or right-tailed tests in which the alternative hypothesis involved
. Here, let's consider an example that tests the equality of two proportions against the alternative that they are not equal. Using statistical
notation, we'll test:
versus
Example 9-5
Time magazine reported the result of a telephone poll of 800 adult Americans. The question posed of the Americans who were surveyed was: "Should
the federal tax on cigarettes be raised to pay for health care reform?" The results of the survey were:
Is there sufficient evidence at the , say, to conclude that the two populations — smokers and non-smokers — differ significantly with respect
to their opinions?
Answer
If = the proportion of the non-smoker population who reply "yes" and = the proportion of the smoker population who reply "yes," then we are
interested in testing the null hypothesis:
https://online.stat.psu.edu/stat415/book/export/html/887 11/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Before we can actually conduct the hypothesis test, we'll have to derive the appropriate test statistic.
Theorem
The test statistic for testing the difference in two population proportions, that is, for testing the null hypothesis is:
where:
Proof
Recall that:
and variance:
But, if we assume that the null hypothesis is true, then the population proportions equal some common value p, say, that is, . In that case,
then the variance becomes:
So, under the assumption that the null hypothesis is true, we have that:
follows (at least approximately) the standard normal N(0,1) distribution. Since we don't know the (assumed) common population proportion p any
more than we know the proportions and of each population, we can estimate p using:
the proportion of "successes" in the two samples combined. And, hence, our test statistic becomes:
as was to be proved.
Time magazine reported the result of a telephone poll of 800 adult Americans. The question posed of the Americans who were surveyed was: "Should
the federal tax on cigarettes be raised to pay for health care reform?" The results of the survey were:
https://online.stat.psu.edu/stat415/book/export/html/887 12/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Is there sufficient evidence at the , say, to conclude that the two populations — smokers and non-smokers — differ significantly with respect
to their opinions?
Answer
versus
is:
Errr.... that Z-value is off the charts, so to speak. Let's go through the formalities anyway making the decision first using the rejection region approach,
and then using the P-value approach. Putting half of the rejection region in each tail, we have:
Z
-1.96 0 1.96
That is, we reject the null hypothesis if or if . We clearly reject , since 8.99 falls in the "red zone," that is, 8.99 is (much)
greater than 1.96. There is sufficient evidence at the 0.05 level to conclude that the two populations differ with respect to their opinions concerning
imposing a federal tax to help pay for health care reform.
Z
-8.99 8.99
That is, the P-value is less than 0.0001. Because , we reject the null hypothesis. Again, there is sufficient evidence at the 0.05
level to conclude that the two populations differ with respect to their opinions concerning imposing a federal tax to help pay for health care reform.
Thankfully, as should always be the case, the two approaches.... the critical value approach and the P-value approach... lead to the same conclusion
https://online.stat.psu.edu/stat415/book/export/html/887 13/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Note!
An advantage of doing so is again that the interpretation of the confidence interval — does it contain 0? — is always consistent with the hypothesis
test decision.
1. Under the Stat menu, select Basic Statistics, and then 1 Proportion...:
2. In the pop-up window that appears, click on the radio button labeled Summarized data. In the box labeled Number of events, type in the
number of successes or events of interest, and in the box labeled Number of trials, type in the sample size n. Click on the box labeled Perform
hypothesis test, and in the box labeled Hypothesized proportion, type in the value of the proportion assumed in the null hypothesis:
https://online.stat.psu.edu/stat415/book/export/html/887 14/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
3. Click on the button labeled Options... In the pop-up window that appears, for the box labeled Alternative, select either less than, greater
than, or not equal depending on the direction of the alternative hypothesis. Click on the box labeled Use test and interval based on normal
distribution:
4. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
As you can see, Minitab reports not only the value of the test statistic (Z = −1.91) but also the P-value (0.028) and the 95% confidence interval
(one-sided in this case, because of the one-sided hypothesis).
1. Under the Stat menu, select Basic Statistics, and then 2 Proportions...:
2. In the pop-up window that appears, click on the radio button labeled Summarized data. In the boxes labeled Events, type in the number of
successes or events of interest for both the First and Second samples. And in the boxes labeled Trials, type in the size of the First sample and
the size of the Second sample:
3. Click on the button labeled Options... In the pop-up window that appears, in the box labeled Test difference, type in the assumed value of the
difference in the proportions that appears in the null hypothesis. The default value is 0.0, the value most commonly assumed, as it means that we
are interested in testing for the equality of the population proportions. For the box labeled Alternative, select either less than, greater than, or
https://online.stat.psu.edu/stat415/book/export/html/887 15/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
not equal depending on the direction of the alternative hypothesis. Click on the box labeled Use pooled estimate of p for test:
4. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
Sample X N Sample P
1 351 605 0.580165
2 41 195 0.210256
Again, as you can see, Minitab reports not only the value of the test statistic (Z = 8.99) but other useful things as well, including the P-value,
which in this case is so small as to be deemed to be 0.000 to three digits. For scientific reporting purposes, we would typically write that as P <
0.0001.
Overview
In this lesson, we'll continue our investigation of hypothesis testing. In this case, we'll focus our attention on a hypothesis test for a population mean
for three situations:
a hypothesis test based on the normal distribution for the mean for the completely unrealistic situation that the population variance is
known
a hypothesis test based on the -distribution for the mean for the (much more) realistic situation that the population variance is unknown
a hypothesis test based on the -distribution for , the mean difference in the responses of two dependent populations
Let's start by acknowledging that it is completely unrealistic to think that we'd find ourselves in the situation of knowing the population variance, but
not the population mean. Therefore, the hypothesis testing method that we learn on this page has limited practical use. We study it only because we'll
use it later to learn about the "power" of a hypothesis test (by learning how to calculate Type II error rates). As usual, let's start with an example.
Example 10-1
Boys of a certain age are known to have a mean weight of pounds. A complaint is made that the boys living in a municipal children's home are
underfed. As one bit of evidence, boys (of the same age) are weighed and found to have a mean weight of = 80.94 pounds. It is known that
the population standard deviation is 11.6 pounds (the unrealistic part of this example!). Based on the available data, what should be concluded
concerning the complaint?
https://online.stat.psu.edu/stat415/book/export/html/887 16/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Answer
The null hypothesis is , and the alternative hypothesis is . In general, we know that if the weights are normally distributed,
then:
follows the standard normal distribution. It is actually a bit irrelevant here whether or not the weights are normally distributed, because the
same size is large enough for the Central Limit Theorem to apply. In that case, we know that , as defined above, follows at least
approximately the standard normal distribution. At any rate, it seems reasonable to use the test statistic:
For the example in hand, the value of the test statistic is:
The critical region approach tells us to reject the null hypothesis at the level if . Therefore, we reject the null hypothesis because
, and therefore falls in the rejection region:
Z
-1.645
-1.75
As always, we draw the same conclusion by using the -value approach. Recall that the -value approach tells us to reject the null hypothesis at the
level if the -value . In this case, the -value is :
0.0401
Z
-1.75
By the way, we'll learn how to ask Minitab to conduct the -test for a mean in a bit, but this is what the Minitab output for this example looks like
this:
Test of mu = 85 vs < 85
The assumed standard deviation = 11.6
95% Upper
N Mean SE Mean Bound Z P
https://online.stat.psu.edu/stat415/book/export/html/887 17/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Now that, for purely pedagogical reasons, we have the unrealistic situation (of a known population variance) behind us, let's turn our attention to the
realistic situation in which both the population mean and population variance are unknown.
Example 10-2
It is assumed that the mean systolic blood pressure is = 120 mm Hg. In the Honolulu Heart Study, a sample of people had an average
systolic blood pressure of 130.1 mm Hg with a standard deviation of 21.21 mm Hg. Is the group significantly different (with respect to systolic blood
pressure!) from the regular population?
Answer
The null hypothesis is , and because there is no specific direction implied, the alternative hypothesis is . In general, we
know that if the data are normally distributed, then:
follows a -distribution with degrees of freedom. Therefore, it seems reasonable to use the test statistic:
for testing the null hypothesis against any of the possible alternative hypotheses , , and . For the
example in hand, the value of the test statistic is:
The critical region approach tells us to reject the null hypothesis at the level if or if .
Therefore, we reject the null hypothesis because , and therefore falls in the rejection region:
-1.9842 1.9842
4.762
Again, as always, we draw the same conclusion by using the -value approach. The -value approach tells us to reject the null hypothesis at the
level if the -value . In this case, the -value is :
4.762 4.762
Again, we'll learn how to ask Minitab to conduct the t-test for a mean in a bit, but this is what the Minitab output for this example looks like:
https://online.stat.psu.edu/stat415/book/export/html/887 18/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
By the way, the decision to reject the null hypothesis is consistent with the one you would make using a 95% confidence interval. Using the data, a 95%
confidence interval for the mean is:
which simplifies to . That is, we can be 95% confident that the mean systolic blood pressure of the Honolulu population is between 125.89
and 134.31 mm Hg. How can a population living in a climate with consistently sunny 80 degree days have elevated blood pressure?!
Anyway, the critical region approach for the hypothesis test tells us to reject the null hypothesis that :
if or if
if or if
if or if
which, upon inserting the data for this particular example, is equivalent to rejecting:
if or if
which just happen to be (!) the endpoints of the 95% confidence interval for the mean. Indeed, the results are consistent!
In the next lesson, we'll learn how to compare the means of two independent populations, but there may be occasions in which we are interested in
comparing the means of two dependent populations. For example, suppose a researcher is interested in determining whether the mean IQ of the
population of first-born twins differs from the mean IQ of the population of second-born twins. She identifies a random sample of pairs of twins, and
measures , the IQ of the first-born twin, and , the IQ of the second-born twin. In that case, she's interested in determining whether:
or equivalently if:
Now, the population of first-born twins is not independent of the population of second-born twins. Since all of our distributional theory requires the
independence of measurements, we're rather stuck. There's a way out though... we can "remove" the dependence between and by subtracting the
two measurements and for each pair of twins , that is, by considering the independent measurements
Then, our null hypothesis involves just a single mean, which we'll denote , the mean of the differences:
and then our hard work is done! We can just use the -test for a mean for conducting the hypothesis test... it's just that, in this situation, our
measurements are differences whose mean is and standard deviation is . That is, when testing the null hypothesis against any of
the alternative hypotheses , , and , we compare the test statistic:
https://online.stat.psu.edu/stat415/book/export/html/887 19/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Example 10-3
Blood samples from = 10 people were sent to each of two laboratories (Lab 1 and Lab 2) for cholesterol determinations. The resulting data are
summarized here:
. . . .
. . . .
Is there a statistically significant difference at the level, say, in the (population) mean cholesterol levels reported by Lab 1 and Lab 2?
Answer
The null hypothesis is , and the alternative hypothesis is . The value of the test statistic is:
The critical region approach tells us to reject the null hypothesis at the level if or if . Therefore, we
reject the null hypothesis because , and therefore falls in the rejection region.
Again, we draw the same conclusion when using the -value approach. In this case, the -value is:
And, the Minitab output for this example looks like this:
Test of mu = 0 vs not = 0
N Mean StDev SE Mean 95% CI T P
1. Under the Stat menu, select Basic Statistics, and then 1-Sample Z...:
https://online.stat.psu.edu/stat415/book/export/html/887 20/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
2. In the pop-up window that appears, click on the radio button labeled Summarized data. In the box labeled Sample size, type in the sample size
n, and in the box labeled Mean, type in the sample mean. In the box labeled Standard deviation, type in the value of the known (or rather
assumed!) population standard deviation. Click on the box labeled Perform hypothesis test, and in the box labeled Hypothesized mean, type in
the value of the mean assumed in the null hypothesis:
3. Click on the button labeled Options... In the pop-up window that appears, for the box labeled Alternative, select either less than, greater
than, or not equal depending on the direction of the alternative hypothesis:
4. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
Test of mu = 85 vs < 85
The assumed standard deviation = 11.6
95% Upper
N Mean SE Mean Bound Z P
1. Under the Stat menu, select Basic Statistics, and then 1-Sample t...:
2. In the pop-up window that appears, click on the radio button labeled Summarized data. In the box labeled Sample size, type in the sample size
n; in the box labeled Mean, type in the sample mean; and in the box labeled Standard deviation, type in the sample standard deviation. Click on
the box labeled Perform hypothesis test, and in the box labeled Hypothesized mean, type in the value of the mean assumed in the null
hypothesis:
https://online.stat.psu.edu/stat415/book/export/html/887 21/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
3. Click on the button labeled Options... In the pop-up window that appears, for the box labeled Alternative, select either less than, greater
than, or not equal depending on the direction of the alternative hypothesis:
4. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
(5) Note that a paired t-test can be performed in the same way. The summarized sample data would simply be the summarized differences. The
extra step of calculating the differences would be required, however, if your data are the raw measurements from the two dependent samples.
That is, if you have two columns containing, say, Before and After measurements for which you want to analyze Diff, their differences, you can use
Minitab's calculator (under the Calc menu, select Calculator) to calculate the differences:
5.
Upon clicking OK, the differences (Diff) should appear in your worksheet:
https://online.stat.psu.edu/stat415/book/export/html/887 22/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
When performing the t-test, you'll then need to tell Minitab (in the Samples in columns box) that the differences are contained in the Diff
column:
Here's what the paired t-test output would look like for this example:
Test of mu = 0 vs not = 0
Variable N Mean StDev SE Mean 95% CI T P
Overview
In this lesson, we'll continue our investigation of hypothesis testing. In this case, we'll focus our attention on a hypothesis test for the difference in two
population means for two situations:
a hypothesis test based on the -distribution, known as the pooled two-sample -test, for when the (unknown) population variances
and are equal
a hypothesis test based on the -distribution, known as Welch's -test, for when the (unknown) population variances and are not
equal
Of course, because population variances are generally not known, there is no way of being 100% sure that the population variances are equal or not
equal. In order to be able to determine, therefore, which of the two hypothesis tests we should use, we'll need to make some assumptions about the
equality of the variances based on our previous knowledge of the populations we're studying.
Let's start with the good news, namely that we've already done the dirty theoretical work in developing a hypothesis test for the difference in two
population means when we developed a confidence interval for the difference in two population means. Recall that if you have
two independent samples from two normal distributions with equal variances , then:
https://online.stat.psu.edu/stat415/book/export/html/887 23/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
follows a distribution where , the pooled sample variance:
is an unbiased estimator of the common variance . Therefore, if we're interested in testing the null hypothesis:
(or equivalently )
and follow the standard hypothesis testing procedures. Let's take a look at an example.
Example 11-1
A psychologist was interested in exploring whether or not male and female college students have different driving behaviors. There were several ways
that she could quantify driving behaviors. She opted to focus on the fastest speed ever driven by an individual. Therefore, the particular statistical
question she framed was as follows:
Is the mean fastest speed driven by male college students different than the mean fastest speed driven by female college students?
She conducted a survey of a random male college students and a random female college students. Here is a descriptive summary of
the results of her survey:
F
56 70 84 98 112 126 140
fastest
Is there sufficient evidence at the level to conclude that the mean fastest speed driven by male college students differs from the mean fastest
speed driven by female college students?
Answer
Because the observed standard deviations of the two samples are of similar magnitude, we'll assume that the population variances are equal. Let's also
assume that the two populations of fastest speed driven for males and females are normally distributed. (We can confirm, or deny, such an assumption
using a normal probability plot, but let's simplify our analysis for now.) The randomness of the two samples allows us to assume independence of the
measurements as well.
https://online.stat.psu.edu/stat415/book/export/html/887 24/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
against the alternative hypothesis:
because, among other things, the pooled sample standard deviation is:
The critical value approach tells us to reject the null hypothesis in favor of the alternative hypothesis if:
We reject the null hypothesis because the test statistic ( ) falls in the rejection region:
-1.9996 1.9996
3.42
There is sufficient evidence at the level to conclude that the average fastest speed driven by the population of male college students differs
from the average fastest speed driven by the population of female college students.
Not surprisingly, the decision is the same using the -value approach. The -value is 0.0012:
Therefore, because , we reject the null hypothesis in favor of the alternative hypothesis. Again, we conclude that there is
sufficient evidence at the level to conclude that the average fastest speed driven by the population of male college students differs from the
average fastest speed driven by the population of female college students.
By the way, we'll see how to tell Minitab to conduct a two-sample t-test in a bit here, but in the meantime, this is what the output would look like:
Let's again start with the good news that we've already done the dirty theoretical work here. Recall that if you have two independent samples from
two normal distributions with unequal variances , then:
follows, at least approximately, a distribution where , the adjusted degrees of freedom is determined by the equation:
https://online.stat.psu.edu/stat415/book/export/html/887 25/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
If r doesn't equal an integer, as it usually doesn't, then we take the integer portion of . That is, we use if necessary.
With that now being recalled, if we're interested in testing the null hypothesis:
(or equivalently )
and follow the standard hypothesis testing procedures. Let's return to our fastest speed driven example.
A psychologist was interested in exploring whether or not male and female college students have different driving behaviors. There were a number of
ways that she could quantify driving behaviors. She opted to focus on the fastest speed ever driven by an individual. Therefore, the particular statistical
question she framed was as follows:
Is the mean fastest speed driven by male college students different than the mean fastest speed driven by female college students?
She conducted a survey of a random male college students and a random female college students. Here is a descriptive summary of
the results of her survey:
Is there sufficient evidence at the level to conclude that the mean fastest speed driven by male college students differs from the mean fastest
speed driven by female college students?
Answer
This time let's not assume that the population variances are equal. Then, we'll see if we arrive at a different conclusion. Let's still assume though that
the two populations of fastest speed driven for males and females are normally distributed. And, we'll again permit the randomness of the two samples
to allow us to assume independence of the measurements as well.
https://online.stat.psu.edu/stat415/book/export/html/887 26/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Oops... that's not an integer, so we're going to need to take the greatest integer portion of that . That is, we take the degrees of freedom to be
.
Then, the critical value approach tells us to reject the null hypothesis in favor of the alternative hypothesis if:
We reject the null hypothesis because the test statistic ( ) falls in the rejection region:
-2.004 2.004
3.54
There is (again!) sufficient evidence at the level to conclude that the average fastest speed driven by the population of male college students
differs from the average fastest speed driven by the population of female college students.
And again, the decision is the same using the -value approach. The -value is 0.0008:
Therefore, because , we reject the null hypothesis in favor of the alternative hypothesis. Again, we conclude that there is
sufficient evidence at the level to conclude that the average fastest speed driven by the population of male college students differs from the
average fastest speed driven by the population of female college students.
At any rate, we see that in this case, our conclusion is the same regardless of whether or not we assume equality of the population variances.
And, just in case you're interested... we'll see how to tell Minitab to conduct a Welch's -test very soon, but in the meantime, this is what the output
would look like for this example:
Just as is the case for asking Minitab to calculate pooled t-intervals and Welch's t-intervals for , the commands necessary for asking Minitab to
perform a two-sample t-test or a Welch's t-test depend on whether the data are entered in two columns, or the data are entered in one column with a
grouping variable in a second column.
Let's recall the spider and prey example, in which the feeding habits of two species of net-casting spiders were studied. The species, the deinopis, and
menneus coexist in eastern Australia. The following data were obtained on the size, in millimeters, of the prey of random samples of the two species:
https://online.stat.psu.edu/stat415/book/export/html/887 27/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
sample 1 sample 2 sample 3 sample 4 sample 5 sample 6 sample 7 sample 8 sample 9 sample 10
10.2 6.9 10.9 11.0 10.1 5.3 7.5 10.3 9.2 8.8
Let's use the data and Minitab to test whether the mean prey size of the populations of the two types of spiders differs.
2. Under the Stat menu, select Basic Statistics, and then select 2-Sample t...:
3. In the pop-up window that appears, select Samples in different columns. Specify the name of the First variable, and specify the name of the
Second variable. For the two-sample (pooled) t-test, click on the box labeled Assume equal variances. (For Welch's t-test, leave the box labeled
Assume equal variances unchecked.):
4. Click on the button labeled Options... In the pop-up window that appears, for the box labeled Alternative, select either less than, greater
than, or not equal depending on the direction of the alternative hypothesis:
5. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
https://online.stat.psu.edu/stat415/book/export/html/887 28/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Two-Sample T: For Deinopis vs
Menneus
Variable N Mean StDev SE Mean
Deinopis 10 10.26 2.51 0.79
When the Data are Entered in One Column, and a Grouping Variable in a Second Column
1. Enter the data in one column (called Prey, say), and the grouping variable in a second column (called Group, say, with 1 denoting a deinopis
spider and 2 denoting a menneus spider), such as:
2. Under the Stat menu, select Basic Statistics, and then select 2-Sample t...:
3. In the pop-up window that appears, select Samples in one column. Specify the name of the Samples variable (Prey, for us) and specify the name
of the Subscripts (grouping) variable (Group, for us). For the two-sample (pooled) t-test, click on the box labeled Assume equal variances. (For
Welch's t-test, leave the box labeled Assume equal variances unchecked.):
https://online.stat.psu.edu/stat415/book/export/html/887 29/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
4. Click on the button labeled Options... In the pop-up window that appears, for the box labeled Alternative, select either less than, greater
than, or not equal depending on the direction of the alternative hypothesis:
5. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
Continuing our development of hypothesis tests for various population parameters, in this lesson, we'll focus on hypothesis tests for population
variances. Specifically, we'll develop:
a hypothesis test for testing whether a single population variance equals a particular value
a hypothesis test for testing whether two population variances are equal
Yeehah again! The theoretical work for developing a hypothesis test for a population variance is already behind us. Recall that if you have a random
sample of size n from a normal population with (unknown) mean and variance , then:
follows a chi-square distribution with n−1 degrees of freedom. Therefore, if we're interested in testing the null hypothesis:
https://online.stat.psu.edu/stat415/book/export/html/887 30/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
and follow the standard hypothesis testing procedures. Let's take a look at an example.
Example 12-1
A manufacturer of hard safety hats for construction workers is concerned about the mean and the variation of the forces its helmets transmits to
wearers when subjected to an external force. The manufacturer has designed the helmets so that the mean force transmitted by the helmets to the
workers is 800 pounds (or less) with a standard deviation to be less than 40 pounds. Tests were run on a random sample of n = 40 helmets, and the
sample mean and sample standard deviation were found to be 825 pounds and 48.5 pounds, respectively.
Do the data provide sufficient evidence, at the level, to conclude that the population standard deviation exceeds 40 pounds?
Answer
Is the test statistic too large for the null hypothesis to be true? Well, the critical value approach would have us finding the threshold value such that
the probability of rejecting the null hypothesis if it were true, that is, of committing a Type I error, is small... 0.05, in this case. Using Minitab (or a chi-
square probability table), we see that the cutoff value is 54.572:
54.572
That is, we reject the null hypothesis in favor of the alternative hypothesis if the test statistic is greater than 54.572. It is. That is, the test statistic falls
in the rejection region:
https://online.stat.psu.edu/stat415/book/export/html/887 31/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
54.572
57.336
Therefore, we conclude that there is sufficient evidence, at the 0.05 level, to conclude that the population standard deviation exceeds 40.
Of course, the P-value approach yields the same conclusion. In this case, the P-value is the probablity that we would observe a chi-square(39) random
variable more extreme than 57.336:
P-value = 0.029
57.336
As the drawing illustrates, the P-value is 0.029 (as determined using the chi-square probability calculator in Minitab). Because , we
reject the null hypothesis in favor of the alternative hypothesis.
Do the data provide sufficient evidence, at the level, to conclude that the population standard deviation differs from 40 pounds?
Answer
Now, is the test statistic either too large or too small for the null hypothesis to be true? Well, the critical value approach would have us dividing the
significance level into 2, to get 0.025, and putting one of the halves in the left tail, and the other half in the other tail. Doing so (and using
Minitab to get the cutoff values), we get that the lower cutoff value is 23.654 and the upper cutoff value is 58.120:
23.654 58.120
That is, we reject the null hypothesis in favor of the two-sided alternative hypothesis if the test statistic is either smaller than 23.654 or greater than
58.120. It is not. That is, the test statistic does not fall in the rejection region:
https://online.stat.psu.edu/stat415/book/export/html/887 32/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
23.654 58.120
57.336
Therefore, we fail to reject the null hypothesis. There is insufficient evidence, at the 0.05 level, to conclude that the population standard deviation
differs from 40.
Of course, the P-value approach again yields the same conclusion. In this case, we simply double the P-value we obtained for the one-tailed test
yielding a P-value of 0.058:
Because , we fail to reject the null hypothesis in favor of the two-sided alternative hypothesis.
The above example illustrates an important fact, namely, that the conclusion for the one-sided test does not always agree with the conclusion for the
two-sided test. If you have reason to believe that the parameter will differ from the null value in a particular direction, then you should conduct the
one-sided test.
Let's now recall the theory necessary for developing a hypothesis test for testing the equality of two population variances. Suppose is
a random sample of size n from a normal population with mean and variance . And, suppose, independent of the first sample, is
another random sample of size m from a normal population with and variance . Recall then, in this situation, that:
have independent chi-square distributions with n−1 and m−1 degrees of freedom, respectively. Therefore:
follows an F distribution with n−1 numerator degrees of freedom and m−1 denominator degrees of freedom. Therefore, if we're interested in testing
the null hypothesis:
(or equivalently )
and follow the standard hypothesis testing procedures. When doing so, we might also want to recall this important fact about the F-distribution:
so that when we use the critical value approach for a two-sided alternative:
https://online.stat.psu.edu/stat415/book/export/html/887 33/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Okay, let's take a look at an example. In the last lesson, we performed a two-sample t-test (as well as Welch's test) to test whether the mean fastest
speed driven by the population of male college students differs from the mean fastest speed driven by the population of female college students.
When we performed the two-sample t-test, we just assumed the population variances were equal. Let's revisit that example again to see if our
assumption of equal variances is valid.
Example 12-2
A psychologist was interested in exploring whether or not male and female college students have different driving behaviors. The particular statistical
question she framed was as follows:
Is the mean fastest speed driven by male college students different than the mean fastest speed driven by female college students?
The psychologist conducted a survey of a random male college students and a random female college students. Here is a descriptive
summary of the results of her survey:
Is there sufficient evidence at the level to conclude that the variance of the fastest speed driven by male college students differs from the
variance of the fastest speed driven by female college students?
Answer
(Note that I intentionally put the variance of what we're calling the Y sample in the numerator and the variance of what we're calling the X sample in
the denominator. I did this only so that my results match the Minitab output we'll obtain on the next page. In doing so, we just need to make sure that
we keep track of the correct numerator and denominator degrees of freedom.) Using the critical value approach, we divide the significance level
into 2, to get 0.025, and put one of the halves in the left tail, and the other half in the other tail. Doing so, we get that the lower cutoff value
is 0.478 and the upper cutoff value is 2.0441:
https://online.stat.psu.edu/stat415/book/export/html/887 34/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Because the test statistic falls in the rejection region, that is, because , we reject the null hypothesis in favor of the alternative
hypothesis. There is sufficient evidence at the level to conclude that the population variances are not equal. Therefore, the assumption of
equal variances that we made when performing the two-sample t-test on these data in the previous lesson does not appear to be valid. It would
behoove us to use Welch's t-test instead.
In each case, we'll illustrate how to perform the hypothesis tests of this lesson using summarized data.
2. In the pop-up window that appears, in the box labeled Data, select Sample standard deviation (or alternatively Sample variance). In the box
labeled Sample size, type in the size n of the sample. In the box labeled Sample standard deviation, type in the sample standard deviation. Click
on the box labeled Perform hypothesis test, and in the box labeled Value, type in the Hypothesized standard deviation (or alternatively the
Hypothesized variance):
https://online.stat.psu.edu/stat415/book/export/html/887 35/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
3. Click on the button labeled Options... In the pop-up window that appears, for the box labeled Alternative, select either less than, greater
than, or not equal depending on the direction of the alternative hypothesis:
4. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
2. In the pop-up window that appears, in the box labeled Data, select Sample standard deviations (or alternatively Sample variances). In the box
labeled Sample size, type in the size n of the First sample and m of the Second sample. In the box labeled Standard deviation, type in the
sample standard deviations for the First and Second samples:
3. Click on the button labeled Options... In the pop-up window that appears, in the box labeled Value, type in the Hypothesized ratio of the
standard deviations (or the Hypothesized ratio of the variances). For the box labeled Alternative, select either less than, greater than, or not
equal depending on the direction of the alternative hypothesis:
https://online.stat.psu.edu/stat415/book/export/html/887 36/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
1. Then, upon clicking OK on the main pop-up window, the output should appear in the Session window:
Method
Statistics
1 29 12.200 148.840
2 34 20.100 404.010
Tests
Test
Method DF1 DF2 P-Value
Statistic
We previously learned how to compare two population means using either the pooled two-sample t-test or Welch's t-test. What happens if we want to
compare more than two means? In this lesson, we'll learn how to do just that. More specifically, we'll learn how to use the analysis of variance method
to compare the equality of the (unknown) means of m normal distributions with an unknown but common variance . Take specific
note about that last part.... "an unknown but common variance ." That is, the analysis of variance method assumes that the population variances are
equal. In that regard, the analysis of variance method can be thought of as an extension of the pooled two-sample t-test.
We could take a top-down approach by first presenting the theory of analysis of variance and then following it up with an example. We're not going to
do it that way though. We're going to take a bottom-up approach, in which we first develop the idea behind the analysis of variance on this page, and
then present the results on the next page. Only after we've completed those two steps will we take a step back and look at the theory behind analysis
of variance. That said, let's start with our first example of the lesson.
https://online.stat.psu.edu/stat415/book/export/html/887 37/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Example 13-1
A researcher for an automobile safety institute was interested in determining whether or not the distance that it takes to stop a car going 60 miles per
hour depends on the brand of the tire. The researcher measured the stopping distance (in feet) of ten randomly selected cars for each of five different
brands. So that he and his assistants would remain blinded, the researcher arbitrarily labeled the brands of the tires as Brand1, Brand2, Brand3, Brand4,
and Brand5. Here are the data resulting from his experiment:
Do the data provide enough evidence to conclude that at least one of the brands is different from the others with respect to stopping distance?
Answer
The first thing we might want to do is to create some sort of summary plot of the data. Here is a box plot of the data:
4
Brand
Distance (feet)
Hmmm. It appears that the box plots for Brand1 and Brand5 have very little, if any, overlap at all. The same can be said for Brand3 and Brand5. Here are
some summary statistics of the data:
Brand N MEAN SD
1 10 188.20 3.88
2 10 195.20 9.02
3 10 187.40 5.27
4 10 191.20 5.55
5 10 200.50 5.44
It appears that the sample means differ quite a bit. For example, the average stopping distance of Brand3 is 187.4 feet (with a standard deviation of
5.27 feet), while the average stopping distance of Brand5 is 200.5 feet (with a standard deviation of 5.44 feet). A difference of 13 feet could mean the
difference between getting into an accident or not. But, of course, we can't draw conclusions about the performance of the brands based on one
https://online.stat.psu.edu/stat415/book/export/html/887 38/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
sample. After all, a different random sample of cars could yield different results. Instead, we need to use the sample means to try to draw conclusions
about the population means.
More specifically, the researcher needs to test the null hypothesis that the group population means are all the same against the alternative that at least
one group population mean differs from the others. That is, the researcher needs to test this null hypothesis:
In this lesson, we are going to learn how to use a method called analysis of variance to answer the researcher's question. Jumping right to the punch
line, with no development or theoretical justification whatsoever, we'll use an analysis of variance table, such as this one:
Analysis of Variance
for comparing all 5 brands
Source DF SS MS F P
Total 49 2836.5
to draw conclusions about the equality of two or more population means. And, as we always do when performing hypothesis tests, we'll compare the
P-value to , our desired willingness to commit a Type I error. In this case, the researcher's P-value is very small (0.000, to three decimal places), so he
should reject his null hypothesis. That is, there is sufficient evidence, at even a 0.01 level, to conclude that the mean stopping distance for at least one
brand of tire is different than the mean stopping distances of the others.
So far, we have seen a typical null and alternative hypothesis in the analysis of variance framework, as well as an analysis of variance table. Let's take a
look at another example with the idea of continuing to work on developing the basic idea behind the analysis of variance method.
Example 13-2
Suppose an education researcher is interested in determining whether a learning method affects students' exam scores. Specifically, suppose she
considers these three methods:
standard
osmosis
shock therapy
Suppose she convinces 15 students to take part in her study, so she randomly assigns 5 students to each method. Then, after waiting eight weeks, she
tests the students to get exam scores.
What would the researcher's data have to look like to be able to conclude that at least one of the methods yields different exam scores than the
others?
Answer
Shock
Osmosis
Standard
40 50 60 70
Exam Scores
What would we want to conclude? Well, there's a lot of separation in the data between the three methods. In this case, there is little variation in the
data within each method, but a lot of variation in the data across the three methods. For these data, we would probably be willing to conclude that
there is a difference between the three methods.
https://online.stat.psu.edu/stat415/book/export/html/887 39/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Now, suppose instead that a dot plot of the researcher's data looked like this:
Shock
Osmosis
Standard
32 42 52 62 72 82
Exam Scores
What would we want to conclude? Well, there's less separation in the data between the three methods. In this case, there is a lot of variation in the data
within each method, and still some variation in the data across the three methods, but not as much as in the previous dot plot. For these data, it is not
as obvious that we can conclude that there is a difference between the three methods.
Shock
Osmosis
Standard
45 55 65 75
Exam Scores
What would we want to conclude here? Well, there's even less separation in the data between the three methods. In this case, there is a real lot of
variation in the data within each method, and not much variation at all in the data across the three methods. For these data, we would probably want
to conclude that there is no difference between the three methods.
If you go back and look at the three possible data sets, you'll see that we drew our conclusions by comparing the variation in the data within a method
to the variation in the data across methods. Let's try to formalize that idea a bit more by revisiting the two most extreme examples. First, the example in
which we concluded that the methods differ:
Grand Mean
Shock
Osmosis
Standard
40 50 60 70
Exam Scores
Let's quantify (or are we still just qualifying?) the amount of variation within a method by comparing the five data points within a method to the
method's mean, as represented in the plot as a color-coded triangle. And, let's quantify (or qualify?) the amount of variation across the methods by
comparing the method means, again represented in the plot as a color-coded triangle, to the overall grand mean, that is, the average of all fifteen data
points (ignoring the method). In this case, the variation between the group means and the grand mean is larger than the variation within the groups.
Now, let's revisit the example in which we wanted to conclude that there was no difference in the three methods:
Grand Mean
Shock
Osmosis
Standard
45 55 65 75
Exam Scores
In this case, the variation between the group means and the grand mean is smaller than the variation within the groups.
Hmmm... these two examples suggest that our method should compare the variation between the groups to that of the variation within the groups.
That's just what an analysis of variance does!
Let's see what conclusion we draw from an analysis of variance of these data. Here's the analysis of variance table for the first study, in which we
wanted to conclude that there was a difference in the three methods:
Source DF SS MS F P
https://online.stat.psu.edu/stat415/book/export/html/887 40/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Total 14 2671.7
In this case, the P-value is small (0.000, to three decimal places). We can reject the null hypothesis of equal means at the 0.05 level. That is, there is
sufficient evidence at the 0.05 level to conclude that the mean exam scores of the three study methods are significantly different.
Here's the analysis of variance table for the third study, in which we wanted to conclude that there was no difference in the three methods:
Source DF SS MS F P
Total 14 1130.9
In this case, the P-value, 0.643, is large. We fail to reject the null hypothesis of equal means at the 0.05 level. That is, there is insufficient evidence at the
0.05 level to conclude that the mean exam scores of the three study methods are significantly different.
We summarize the division of the variability in an "analysis of variance table", which is often shortened and called an "ANOVA table." Without
knowing what we were really looking at, we looked at a few examples of ANOVA tables here on this page. Let's now go take an in-depth look at the
content of ANOVA tables.
For the sake of concreteness here, let's recall one of the analysis of variance tables from the previous page:
Source DF SS MS F P
Total 14 2671.7
In working to digest what is all contained in an ANOVA table, let's start with the column headings:
1. Source means "the source of the variation in the data." As we'll soon see, the possible choices for a one-factor study, such as the learning study,
are Factor, Error, and Total. The factor is the characteristic that defines the populations being compared. In the tire study, the factor is the brand
of tire. In the learning study, the factor is the learning method.
2. DF means "the degrees of freedom in the source."
3. SS means "the sum of squares due to the source."
4. MS means "the mean sum of squares due to the source."
5. F means "the F-statistic."
6. P means "the P-value."
1. Factor means "the variability due to the factor of interest." In the tire example on the previous page, the factor was the brand of the tire. In the
learning example on the previous page, the factor was the method of learning.
Sometimes, the factor is a treatment, and therefore the row heading is instead labeled as Treatment. And, sometimes the row heading is labeled
as Between to make it clear that the row concerns the variation between the groups.
2. Error means "the variability within the groups" or "unexplained random error." Sometimes, the row heading is labeled as Within to make it clear
that the row concerns the variation within the groups.
3. Total means "the total variation in the data from the grand mean" (that is, ignoring the factor of interest).
With the column headings and row headings now defined, let's take a look at the individual entries inside a general one-factor ANOVA table:
Yikes, that looks overwhelming! Let's work our way through it entry by entry to see if we can make it all clear. Let's start with the degrees of freedom
(DF) column:
1. If there are n total data points collected, then there are n−1 total degrees of freedom.
2. If there are m groups being compared, then there are m−1 degrees of freedom associated with the factor of interest.
3. If there are n total data points collected and m groups being compared, then there are n−m error degrees of freedom.
1. As we'll soon formalize below, SS(Between) is the sum of squares between the group means and the grand mean. As the name suggests, it
quantifies the variability between the groups of interest.
2. Again, as we'll formalize below, SS(Error) is the sum of squares between the data and the group means. It quantifies the variability within the
groups of interest.
3. SS(Total) is the sum of squares between the n data points and the grand mean. As the name suggests, it quantifies the total variability in the
observed data. We'll soon see that the total sum of squares, SS(Total), can be obtained by adding the between sum of squares, SS(Between), to
the error sum of squares, SS(Error). That is:
The mean squares (MS) column, as the name suggests, contains the "average" sum of squares for the Factor and the Error:
1. The Mean Sum of Squares between the groups, denoted MSB, is calculated by dividing the Sum of Squares between the groups by the between
group degrees of freedom. That is, MSB = SS(Between)/(m−1).
2. The Error Mean Sum of Squares, denoted MSE, is calculated by dividing the Sum of Squares within the groups by the error degrees of freedom.
That is, MSE = SS(Error)/(n−m).
The F column, not surprisingly, contains the F-statistic. Because we want to compare the "average" variability between the groups to the "average"
variability within the groups, we take the ratio of the Between Mean Sum of Squares to the Error Mean Sum of Squares. That is, the F-statistic is
calculated as F = MSB/MSE.
When, on the next page, we delve into the theory behind the analysis of variance method, we'll see that the F-statistic follows an F-distribution with
m−1 numerator degrees of freedom and n−m denominator degrees of freedom. Therefore, we'll calculate the P-value, as it appears in the column
labeled P, by comparing the F-statistic to an F-distribution with m−1 numerator degrees of freedom and n−m denominator degrees of freedom.
Now, having defined the individual entries of a general ANOVA table, let's revisit and, in the process, dissect the ANOVA table for the first learning
study on the previous page, in which n = 15 students were subjected to one of m = 3 methods of learning:
5. MSB is SS(Between) divided by the between group degrees of freedom. That is, 1255.3 = 2510.5 ÷ 2.
6. MSE is SS(Error) divided by the error degrees of freedom. That is, 13.4 = 161.2 ÷ 12.
7. The F-statistic is the ratio of MSB to MSE. That is, F = 1255.3 ÷ 13.4 = 93.44.
8. The P-value is P(F(2,12) ≥ 93.44) < 0.001.
Okay, we slowly, but surely, keep on adding bit by bit to our knowledge of an analysis of variance table. Let's now work a bit on the sums of squares.
https://online.stat.psu.edu/stat415/book/export/html/887 42/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
1. a component that is due to the TREATMENT (or FACTOR), and
2. a component that is due to just RANDOM ERROR.
Let's see what kind of formulas we can come up with for quantifying these components. But first, as always, we need to define some notation. Let's
represent our data, the group means, and the grand mean as follows:
1 ...
2 ...
. . . . . .
. . . . . .
. . . . . .
...
Grand Mean
Okay, with the notation now defined, let's first consider the total sum of squares, which we'll denote here as SS(TO). Because we want the total sum of
squares to quantify the variation in the data regardless of its source, it makes sense that SS(TO) would be the sum of the squared distances of the
observations to the grand mean . That is:
With just a little bit of algebraic work, the total sum of squares can be alternatively calculated as:
Now, let's consider the treatment sum of squares, which we'll denote SS(T). Because we want the treatment sum of squares to quantify the variation
between the treatment groups, it makes sense that SS(T) would be the sum of the squared distances of the treatment means to the grand mean
. That is:
Again, with just a little bit of algebraic work, the treatment sum of squares can be alternatively calculated as:
Finally, let's consider the error sum of squares, which we'll denote SS(E). Because we want the error sum of squares to quantify the variation in the
data, not otherwise explained by the treatment, it makes sense that SS(E) would be the sum of the squared distances of the observations to the
treatment means . That is:
As we'll see in just one short minute why the easiest way to calculate the error sum of squares is by subtracting the treatment sum of squares from the
total sum of squares. That is:
Okay, now, do you remember that part about wanting to break down the total variation SS(TO) into a component due to the treatment SS(T) and a
component due to random error SS(E)? Well, some simple algebra leads us to this:
and hence why the simple way of calculating the error of the sum of squares. At any rate, here's the simple algebra:
Proof
https://online.stat.psu.edu/stat415/book/export/html/887 43/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Well, okay, so the proof does involve a little trick of adding 0 in a special way to the total sum of squares:
Then, squaring the term in parentheses, as well as distributing the summation signs, we get:
as was to be proved.
So far, in an attempt to understand the analysis of variance method conceptually, we've been waving our hands at the theory behind the method. We
can't procrastinate any further... we now need to address some of the theories behind the method. Specifically, we need to address the distribution of
the error sum of squares (SSE), the distribution of the treatment sum of squares (SST), and the distribution of the all-important F-statistic.
quantifies the error remaining after explaining some of the variation in the observations by the treatment means. Let's see what we can say about
SSE. Well, the following theorem enlightens us as to the distribution of the error sum of squares.
Theorem
If:
1. the measurement of the group, that is, , is an independently and normally distributed random variable with mean and variance
Then:
Proof
A theorem we learned (way) back in Stat 414 tells us that if the two conditions stated in the theorem hold, then:
follows a chi-square distribution with degrees of freedom. Another theorem we learned back in Stat 414 states that if we add up a bunch of
independent chi-square random variables, then we get a chi-square random variable with the degrees of freedom added up, too. So, let's add up the
above quantity for all n data points, that is, for to and to m. Doing so, we get:
Because we assume independence of the observations , we are adding up independent chi-square random variables. (By the way, the assumption
of independence is a perfectly fine assumption as long as we take a random sample when we collect the data.) Therefore, the theorem tells us that
follows a chi-square random variable with:
https://online.stat.psu.edu/stat415/book/export/html/887 44/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Now, what can we say about the mean square error MSE? Well, one thing is...
Theorem
The mean square error MSE is (always) an unbiased estimator of .
Recall that to show that MSE is an unbiased estimator of , we need to show that . Also, recall that the expected value of a chi-square
random variable is its degrees of freedom. The results of the previous theorem, therefore, suggest that:
The first equality comes from the definition of MSE. The second equality comes from multiplying MSE by 1 in a special way. The third equality comes
from taking the expected value of . And, the fourth and final equality comes from simple algebra.
Because , we have shown that, no matter what, MSE is an unbiased estimator of ... always!
quantifies the distance of the treatment means from the grand mean. We'll just state the distribution of SST without proof.
Theorem
is true, then:
When we investigated the mean square error MSE above, we were able to conclude that MSE was always an unbiased estimator of . Can the same be
said for the mean square due to treatment MST = SST/(m−1)? Well...
Theorem
The mean square due to treatment is an unbiased estimator of only if the null hypothesis is true, that is, only if the m population means are equal.
Answer
Since MST is a function of the sum of squares due to treatment SST, let's start with finding the expected value of SST. We learned, on the previous page,
that the definition of SST can be written as:
Now, because, in general, , we can do some substituting into that last equation, which simplifies to:
where:
because:
https://online.stat.psu.edu/stat415/book/export/html/887 45/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Okay, so we've simplified E(SST) as far as is probably necessary. Let's use it now to find E(MST).
Well, if the null hypothesis is true, , say, the expected value of the mean square due to treatment is:
On the other hand, if the null hypothesis is not true, that is, if not all of the are equal, then:
So, in summary, we have shown that MST is an unbiased estimator of if the null hypothesis is true, that is, if all of the means are equal. On the other
hand, we have shown that, if the null hypothesis is not true, that is, if all of the means are not equal, then MST is a biased estimator of because
E(MST) is inflated above . Our proof is complete.
Our work on finding the expected values of MST and MSE suggests a reasonable statistic for testing the null hypothesis:
is:
Now, why would this F be a reasonable statistic? Well, we showed above that . We also showed that under the null hypothesis, when
the means are assumed to be equal, , and under the alternative hypothesis when the means are not all equal, E(MST) is inflated above
. That suggests then that:
1. If the null hypothesis is true, that is, if all of the population means are equal, we'd expect the ratio MST/MSE to be close to 1.
2. If the alternative hypothesis is true, that is, if at least one of the population means differs from the others, we'd expect the ratio MST/MSE to be
inflated above 1.
The F-statistic
Theorem
If , ), then:
follows an F distribution with m−1 numerator degrees of freedom and n−m denominator degrees of freedom.
Answer
It can be shown (we won't) that SST and SSE are independent. Then, it's just a matter of recalling that an F random variable is defined to be the ratio of
two independent chi-square random variables. That is:
as was to be proved.
https://online.stat.psu.edu/stat415/book/export/html/887 46/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Now this all suggests that we should reject the null hypothesis of equal population means:
if or if
If you go back and look at the assumptions that we made in deriving the analysis of variance F-test, you'll see that the F-test for the equality of means
depends on three assumptions about the data:
independence
normality
equal group variances
That means that you'll want to use the F-test only if there is evidence to believe that the assumptions are met. That said, as is the case with the two-
sample t-test, the F-test works quite well even if the underlying measurements are not normally distributed unless the data are highly skewed or the
variances are markedly different. If the data are highly skewed, or if there is evidence that the variances differ greatly, we have two analysis options at
our disposal. We could attempt to transform the observations (take the natural log of each value, for example) to make the data more symmetric with
more similar variances. Alternatively, we could use nonparametric methods (that are unfortunately not covered in this course).
Example 13-3
A researcher was interested in investigating whether Holocaust survivors have more sleep problems than others. She evaluated subjects in
total, a subset of them were Holocaust survivors, a subset of them were documented as being depressed, and another subset of them were deemed
healthy. (Of course, it's not at all obvious that these are mutually exclusive groups.) At any rate, all n = 120 subjects completed a questionnaire about
the quality and duration of their regular sleep patterns. As a result of the questionnaire, each subject was assigned a Pittsburgh Sleep Quality Index
(PSQI). Here's a dot plot of the resulting data:
Grand Mean
Healthy
Depress
Survivor
0 10 20
Pittsburgh Sleep Quality Index
Is there sufficient evidence at the level to conclude that the mean PSQI for the three groups differ?
Answer
We can use Minitab to obtain the analysis of variance table. Doing so, we get:
Source DF SS MS F P
Since P < 0.001 ≤ 0.05, we reject the null hypothesis of equal means in favor of the alternative hypothesis of unequal means. There is sufficient
evidence at the 0.05 level to conclude that the mean Pittsburgh Sleep Quality Index differs among the three groups.
https://online.stat.psu.edu/stat415/book/export/html/887 47/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Minitab®
Using Minitab
There is no doubt that you'll want to use Minitab when performing an analysis of variance. The commands necessary to perform a one-factor analysis
of variance in Minitab depends on whether the data in your worksheet are "stacked" or "unstacked." Let's illustrate using the learning method study
data. Here's what the data would look like unstacked:
51 58 77
45 68 72
40 64 78
41 63 73
41 62 75
That is, the data from each group resides in a different column in the worksheet. If your data are entered in this way, then follow these instructions for
performing the one-factor analysis of variance:
Method Score
1 51
1 45
1 40
1 41
1 41
2 58
2 68
2 64
2 63
2 62
3 77
3 72
3 78
3 73
3 75
That is, one column contains a grouping variable, and another column contains the responses. If your data are entered in this way, then follow these
instructions for performing the one-factor analysis of variance:
https://online.stat.psu.edu/stat415/book/export/html/887 48/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Overview
In the previous lesson, we learned how to conduct an analysis of variance in an attempt to learn whether a (that's one!) factor played a role in the
observed responses. For example, we investigated whether the learning method (the factor) influenced a student's exam score (the response). We also
investigated whether tire brand (the factor) influenced a car's stopping distance (the response).
What happens if we're not interested in whether one factor is associated with the observed responses, but whether two or three or more factors are
associated with the observed responses. For example, we might be interested in learning whether smoking history (one factor) and type of stress test (a
second factor) are associated with the time until maximum oxygen uptake (the response). That's the kind of data that we'll learn to analyze in this
lesson. Specifically, we'll learn how to conduct a two-factor analysis of variance, so that we can test whether either of the two factors or their interaction
are associated with some continuous response.
The reality is this online lesson only contains an example of a two-factor analysis of variance. For the theoretical development, you are asked to refer to
the textbook chapter on Two-Factor Analysis of Variance. Pedagogically, it is material that lends itself well to getting practice at learning a new
statistical method solely from the formal presentation of a statistical textbook.
14.1 - An Example
14.1 - An Example
Example 14-1
A physiologist was interested in learning whether smoking history and different types of stress tests influence the timing of a subject's maximum
oxygen uptake, as measured in minutes. The researcher classified a subject's smoking history as either heavy smoking, moderate smoking, or non-
smoking. He was interested in seeing the effects of three different types of stress tests — a test performed on a bicycle, a test on a treadmill, and a test
on steps. The physiologist recruited 9 non-smokers, 9 moderate smokers, and 9 heavy smokers to participate in his experiment, for a total of n = 27
subjects. He then randomly assigned each of his recruited subjects to undergo one of the three types of stress tests. Here is his resulting data:
Test
Nonsmoker (1) 12.8, 13.5, 11.2 16.2, 18.1, 17.8 22.6, 19.3, 18.9
Moderate (2) 10.9, 11.1, 9.8 15.5, 13.8, 16.2 20.1, 21.0, 15.9
Heavy (3) 8.7, 9.2, 7.5 14.7, 13.2, 8.1 16.2, 16.1, 17.8
Is there sufficient evidence at the level to conclude that smoking history has an effect on the time to maximum oxygen uptake? Is there
sufficient evidence at the level to conclude that the type of stress test has an effect on the time to maximum oxygen uptake? And, is there
evidence of an interaction between smoking history and the type of stress test?
Answer
Let's start by stating our analysis of variance model, as well as any assumptions that we'll make. Let denote the time, in minutes, until maximum
oxygen uptake for smoking history , type of test , and replicate . So, for example, , and so
on. Let's assume the are mutually independent normal random variables with common variance and mean:
, , , and
In that case, testing whether or not there is an interaction between smoking history and the type of stress test involves testing the null hypothesis:
against all of the possible alternatives. We'll definitely want to engage Minitab in conducting the necessary analysis of variance! To do so, we first enter
the data into a Minitab worksheet in an unstacked manner. We then do the following: [1]
1. Under the Stat menu, we select ANOVA, and then Balanced ANOVA... (our data are "balanced" because every cell contains the same number of
measurements, 3).
2. In the pop-up window that appears, we specify the Response and the Model:
https://online.stat.psu.edu/stat415/book/export/html/887 49/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
You might want to take particular note of the way we specify the interaction between smoking status and the type of test in Minitab, namely, as
Smoker*Test.
3. We select OK, and the resulting output appears in the Session Window.
Here's what the output looks like with the row pertaining to the interaction term highlighted in yellow:
Smoker fixed 3 1, 2, 3
Test fixed 3 1, 2, 3
Analysis of Variance for Time
Source DF SS MS F P
Total 26 445.032
As you can see, the P-value, 0.927, is very large. We do not reject the null hypothesis that the interaction terms are all zero. That is, there is insufficient
evidence at the 0.05 level to conclude that there is an interaction between smoking history and the type of stress test.
Now, testing whether or not smoking history has an effect on the timing of maximum oxygen uptake involves testing the null hypothesis:
against all of the possible alternatives. Here's what the output looks like with the row pertaining to the smoking history term highlighted in yellow:
Smoker fixed 3 1, 2, 3
Test fixed 3 1, 2, 3
Analysis of Variance for Time
Source DF SS MS F P
Total 26 445.032
As you can see, the P-value is very small (< 0.001). We reject the null hypothesis that the smoking history parameters are all zero. That is, there is
sufficient evidence at the 0.05 level to conclude that smoking history has an effect on the timing of maximum oxygen uptake.
Now, testing whether or not the type of stress test has an effect on the timing of maximum oxygen uptake involves testing the null hypothesis:
https://online.stat.psu.edu/stat415/book/export/html/887 50/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
against all of the possible alternatives. Here's what the output looks like with the row pertaining to the type of stress test term highlighted in yellow:
Smoker fixed 3 1, 2, 3
Test fixed 3 1, 2, 3
Analysis of Variance for Time
Source DF SS MS F P
Total 26 445.032
As you can see, again, the P-value is very small (< 0.001). We reject the null hypothesis that the stress test parameters are all zero. That is, there is
sufficient evidence at the 0.05 level to conclude that the type of stress test has an effect on the timing of maximum oxygen uptake.
In summary, based on these data, the physiologist can conclude that there appears to be an effect due to smoking history and the type of stress test,
but that the data do not suggest that the two factors interact in any way.
Note!
We were able to include an interaction term in our model in the previous example, because we had multiple observations (three, to be exact) falling in
each of the cells. That is, if there is only one observation in each cell, we cannot include an interaction term in our model.
Overview
In lessons 35 and 36, we learned how to calculate point and interval estimates of the intercept and slope parameters, and , of a simple linear
regression model:
with the random errors following a normal distribution with mean 0 and variance . In this lesson, we'll learn how to conduct a hypothesis test for
testing the null hypothesis that the slope parameter equals some value, , say. Specifically, we'll learn how to test the null hypothesis
using a -statistic.
Now, perhaps it is not a point that has been emphasized yet, but if you take a look at the form of the simple linear regression model, you'll notice that
the response 's are denoted using a capital letter, while the predictor 's are denoted using a lowercase letter. That's because, in the simple linear
regression setting, we view the predictors as fixed values, whereas we view the responses as random variables whose possible values depend on the
population from which they came. Suppose instead that we had a situation in which we thought of the pair as being a random sample,
, from a bivariate normal distribution with parameters , , , and . Then, we might be interested in testing the null
hypothesis , because we know that if the correlation coefficient is 0, then and are independent random variables. For this reason, we'll
learn, not one, but three (!) possible hypothesis tests for testing the null hypothesis that the correlation coefficient is 0. Then, because we haven't yet
derived an interval estimate for the correlation coefficient, we'll also take the time to derive an approximate confidence interval for .
Once again we've already done the bulk of the theoretical work in developing a hypothesis test for the slope parameter of a simple linear regression
model when we developed a confidence interval for . We had shown then that:
, ,
https://online.stat.psu.edu/stat415/book/export/html/887 51/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
we can use the test statistic:
and follow the standard hypothesis testing procedures. Let's take a look at an example.
Example 15-1
In alligators' natural habitat, it is typically easier to observe the length of an alligator than it is the weight. This data set contains the log weight ( ) and
log length ( ) for 15 alligators captured in central Florida. A scatter plot of the data suggests that there is a linear relationship between the response
and the predictor . Therefore, a wildlife researcher is interested in fitting the linear model: [2] [3]
to the data. She is particularly interested in testing whether there is a relationship between the length and weight of alligators. At the level,
perform a test of the null hypothesis against the alternative hypothesis .
Answer
The easiest way to perform the hypothesis test is to let Minitab do the work for us! Under the Stat menu, selecting Regression, and then Regression,
and specifying the response logW (for log weight) and the predictor logL (for log length), we get:
Analysis of Variance
Source DF SS MS F P
Total 14 10.260
Easy as pie! Minitab tells us that the test statistic is (in blue) with a -value (0.000) that is less than 0.001. Because the -value is less than
0.05, we reject the null hypothesis at the 0.05 level. There is sufficient evidence to conclude that the slope parameter does not equal 0. That is, there is
sufficient evidence, at the 0.05 level, to conclude that there is a linear relationship, among the population of alligators, between the log length and log
weight.
Of course, since we are learning this material for just the first time, perhaps we could go through the calculation of the test statistic at least once.
Letting Minitab do some of the dirtier calculations for us, such as calculating:
as well as determining that and that the slope estimate = 3.4311, we get:
which is the test statistic that Minitab calculated... well, with just a bit of round-off error.
https://online.stat.psu.edu/stat415/book/export/html/887 52/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
The hypothesis test for the slope that we developed on the previous page was developed under the assumption that a response is a linear function
of a nonrandom predictor . This situation occurs when the researcher has complete control of the values of the variable . For example, a researcher
might be interested in modeling the linear relationship between the temperature of an oven and the moistness of chocolate chip muffins. In this
case, the researcher sets the oven temperatures (in degrees Fahrenheit) to 350, 360, 370, and so on, and then observes the values of the random
variable , that is, the moistness of the baked muffins. In this case, the linear model:
There are other situations, however, in which the variable is not nonrandom (yes, that's a double negative!), but rather an observed value of a random
variable . For example, a fisheries researcher may want to relate the age of a sardine to its length . If a linear relationship could be established,
then in the future fisheries researchers could predict the age of a sardine simply by measuring its length. In this case, the linear model:
is a linear function of the length. That is, the conditional mean of given is a linear function. Now, in this second situation, in which both
and are deemed random, we typically assume that the pairs are a random sample from a bivariate normal
distribution with means and , variances and , and correlation coefficient . If that's the case, it can be shown that the conditional mean:
That is:
Now, for the case where has a bivariate distribution, the researcher may not necessarily be interested in estimating the linear function:
but rather simply knowing whether and are independent. In STAT 414, we've learned that if follows a bivariate normal distribution, then
testing for the independence of and is equivalent to testing whether the correlation coefficient equals 0. We'll now work on developing three
different hypothesis tests for testing assuming follows a bivariate normal distribution.
then:
That suggests, therefore, that testing for against any of the alternative hypotheses , and is equivalent
to testing against the corresponding alternative hypothesis , and . That is, we can simply compare the
test statistic:
https://online.stat.psu.edu/stat415/book/export/html/887 53/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
to a distribution with degrees of freedom. It should be noted, though, that the test statistic can be instead written as a function of the sample
correlation coefficient:
and because of its algebraic equivalence to the first test statistic, it too follows a distribution with degrees of freedom. Huh? How are the two
test statistics algebraically equivalent? Well, if the following two statements are true:
1.
2.
then simple algebra illustrates that the two test statistics are indeed algebraically equivalent:
Now, for the veracity of those two statements? Well, they are indeed true. The first one requires just some simple algebra. The second one requires a
bit of trickier algebra that you'll soon be asked to work through for homework.
but the probability distribution of is difficult to obtain. It turns out though that we can derive a hypothesis test using just provided that we are
interested in testing the more specific null hypothesis that and are independent, that is, for testing .
Theorem
Provided that , the probability density function of the sample correlation coefficient is:
Proof
We'll use the distribution function technique, in which we first find the cumulative distribution function , and then differentiate it to get the
desired probability density function . The cumulative distribution function is:
The first equality is just the definition of the cumulative distribution function, while the second and third equalities come from the definition of the
statistic as a function of the sample correlation coefficient . Now, using what we know of the p.d.f. of a random variable with degrees of
freedom, we get:
Now, it's just a matter of taking the derivative of the c.d.f. to get the p.d.f. ). Using the Fundamental Theorem of Calculus, in conjunction with
the chain rule, we get:
https://online.stat.psu.edu/stat415/book/export/html/887 54/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Focusing first on the derivative part of that equation, using the quotient rule, we get:
Simplifying, we get:
Now, looking back at , let's work on the part. Replacing the function in the one place where a t appears in the p.d.f. of a random variable
with degrees of freedom, we get:
Now, because:
we finally get:
We're almost there! We just need to multiply the two parts together. Doing so, we get:
Now that we know the p.d.f. of , testing against any of the possible alternative hypotheses just involves integrating to find the
critical value(s) to ensure that , the probability of a Type I error is small. For example, to test against the alternative , we find
the value such that:
Yikes! Do you have any interest in integrating that function? Well, me neither! That's why we'll instead use an Table, such as the one we have in Table
IX at the back of our textbook.
Theorem
The statistic:
https://online.stat.psu.edu/stat415/book/export/html/887 55/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
The theorem, therefore, allows us to test the general null hypothesis against any of the possible alternative hypotheses comparing the test
statistic:
What? We've looked at no examples yet on this page? Let's take care of that by closing with an example that utilizes each of the three hypothesis tests
we derived above.
Example 15-2
An admissions counselor at a large public university was interested in learning whether freshmen calculus grades are independent of high school math
achievement test scores. The sample correlation coefficient between the mathematics achievement test scores and calculus grades for a random
sample of college freshmen was deemed to be 0.84.
Does this observed sample correlation coefficient suggest, at the level, that the population of freshmen calculus grades are independent of
the population of high school math achievement test scores?
Answer
against
We reject the null hypothesis if the test statistic is greater than 2.306 or less than −2.306.
-2.306 2.306
Because , we reject the null hypothesis in favor of the alternative hypothesis. There is sufficient evidence at the 0.05 level to conclude
that the population of freshmen calculus grades are not independent of the population of high school math achievement test scores.
Using the R-statistic, with 8 degrees of freedom, Table IX in the back of the book tells us to reject the null hypothesis if the absolute value of is
greater than 0.6319. Because our observed , we again reject the null hypothesis in favor of the alternative hypothesis. There is
sufficient evidence at the 0.05 level to conclude that freshmen calculus grades are not independent of high school math achievement test scores.
https://online.stat.psu.edu/stat415/book/export/html/887 56/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
In this case, we reject the null hypothesis if the absolute value of were greater than 1.96. It clearly is, and so we again reject the null hypothesis in
favor of the alternative hypothesis. There is sufficient evidence at the 0.05 level to conclude that freshmen calculus grades are not independent of high
school math achievement test scores.
To develop an approximate confidence interval for , we'll use the normal approximation for the statistic that we used on the previous
page for testing .
Theorem
An approximate confidence interval for is where:
and
Proof
We previously learned that:
follows at least approximately a standard normal distribution. So, we can do our usual trick of starting with a probability statement:
to get ..... can you fill in the details?! ..... the formula for a confidence interval for :
where:
and
as was to be proved!
An admissions counselor at a large public university was interested in learning whether freshmen calculus grades are independent of high school math
achievement test scores. The sample correlation coefficient between the mathematics achievement test scores and calculus grades for a random
sample of college freshmen was deemed to be 0.84.
https://online.stat.psu.edu/stat415/book/export/html/887 57/58
3/16/25, 12:24 AM Section 2: Hypothesis Testing
Estimate the population correlation coefficient with 95% confidence.
Answer
Because we are interested in a 95% confidence interval, we use . Therefore, the lower limit of an approximate 95% confidence interval for
is:
and the upper limit of an approximate 95% confidence interval for is:
We can be (approximately) 95% confident that the correlation between the population of high school mathematics achievement test scores and
freshmen calculus grades is between 0.447 and 0.961. (Not a particularly useful interval, I might say! It might behoove the admissions counselor to
collect data on a larger sample, so that he or she can obtain a narrower confidence interval.)
Legend
[1] Link
↥ Has Tooltip/Popover
Toggleable Visibility
Source: https://online.stat.psu.edu/stat415/section/7
Links:
1. https://online.stat.psu.edu/stat415/sites/stat415/files//lesson42/Lesson42_Minitab01.gif
2. https://online.stat.psu.edu/stat415/sites/stat415/files//lesson43/Lesson43_Minitab01.gif
3. https://online.stat.psu.edu/stat415/sites/stat415/files//lesson43/Lesson43_Minitab02.gif
https://online.stat.psu.edu/stat415/book/export/html/887 58/58