Hypothesis Testing
An Introduction to Hypothesis Testing
If someone is guessing randomly, there is a 25% chance of getting a card's suit right. Pete says
he does better than this on average. To test his claim, we made Pete guess the suit of a
randomly selected card 100 times. He guessed correctly 28 times. On average, he should've
only gotten 25 correct if he was purely guessing, so there isn't strong evidence that Pete is
better than a one-quarter chance of correctly guessing the suit. We informally conducted a
hypothesis test where we turned a question of interest into hypotheses a bout the value of a
parameter(s). We created a null hypothesis (no effect or difference) and an alternative
hypothesis (the null hypothesis is wrong). We calculated an appropriate test statistic based on
the sample data and determined how much evidence that gives us against the null hypothesis.
The appropriate null hypothesis for a situation where we want to compare the difference
between males and females would be that there is no difference between them. The alternative
hypothesis would then be that the null hypothesis is wrong. The choice of alternative
hypothesis depends on the setting, and we'll explore a few examples later on. However, this
brief introduction leaves many unanswered questions.
It is crucial to draw the appropriate conclusion at the en d because our goal is to answer the
questions we find interesting. The result should demonstrate that we are outperforming
individuals who are making guesses at random.
Therefore, it is paramount to evaluate the data and the information gathered from vari ous
sources to formulate a valid conclusion.
Ultimately, arriving at a sound conclusion provides assurance that we have made progress
towards our goal of gaining knowledge about a particular subject matter.
Z Tests for One Mean: Introduction
There are two different scenarios when it comes to hypothesis testing. If the population standard
deviation, σ, is known, a z-test is used (although this is rare). However, if σ is unknown, we test the null
hypothesis that the population mean μ is equal to a hypothesized value μ0.
To test this null hypothesis, we use the test statistic:
z = x̄ - μ0 / σ̅x
This test statistic will have the standard normal distribution. For example, let's suppose a supplier to a
sushi restaurant claims their blue fin tuna contains no more than 0.4 parts per million of mercury on
average. If the 16 pieces of tuna had a mean of 0.74, we can see if this difference gives us strong
evidence against the null hypothesis. Visually, the observations look well above the hypothesized
mean value, but there is some variability involved.
, Hypothesis Testing
There is compelling evidence that the actual average amount of mercury in blue fin tuna obtained
from this supplier exceeds the claimed level of 0.4 parts per million. The observations we made would
be highly unlikely if the null hypothesis were valid. We have two options to proceed: the rejection
region method or the p-value method.
Formula:
Example:
Suppose we have a sample of 40 blue fin tuna and the sample mean mercury level is 0.44 parts per
million. Assume the population standard deviation is 0.06 parts per million. We want to test if the true
mean mercury level is greater than the claimed 0.4 parts per million. Using a significance level of 0.05
and assuming a normal distribution, we find that the critical z-value is 1.645. The test statistic is
calculated as:
Plugging in the values, we get:
Since 3.09 is greater than 1.645, we reject the null hypothesis and conclude that there is sufficient
evidence that the true mean mercury level is greater than 0.4 parts per million.
"The observed data would be highly unlikely if the null hypothesis were true."
Z Tests for One Mean: The Rejection Region Approach
The rejection region approach involves:
• Choosing a value for alpha which we call the significance level of the test.
• Alpha is the probability of rejecting the null hypothesis if it is true.
• The appropriate choice of alpha depends on the problem at hand.
• Then we're going to find the appropriate rejection region.
• If we get a value in the middle, we're going to not reject the null hypothesis.
If we keep the alpha level the same but change the alternative hypothesis to mu being less than mu_0,
then values of this test statistic that are in the left tail of the distribution give us evidence against the
null. And so for an alpha level of 0.05, we are going to reject the null hypothesis if the z value in our
sample is less than or equal to 1.645. If the z value that we observe is less than or equal to 2.33, we
can reject the null hypothesis at alpha = 0.05.
If we happen to get a z value of 1.6448, say, we would not reject the null hypothesis. If we got a z
value that was very huge, let's say, 17819, we have the same conclusions in these two situations, even
though this one has by a great deal more evidence against the null hypothesis.
Z Tests for One Mean: The p-value
An Introduction to Hypothesis Testing
If someone is guessing randomly, there is a 25% chance of getting a card's suit right. Pete says
he does better than this on average. To test his claim, we made Pete guess the suit of a
randomly selected card 100 times. He guessed correctly 28 times. On average, he should've
only gotten 25 correct if he was purely guessing, so there isn't strong evidence that Pete is
better than a one-quarter chance of correctly guessing the suit. We informally conducted a
hypothesis test where we turned a question of interest into hypotheses a bout the value of a
parameter(s). We created a null hypothesis (no effect or difference) and an alternative
hypothesis (the null hypothesis is wrong). We calculated an appropriate test statistic based on
the sample data and determined how much evidence that gives us against the null hypothesis.
The appropriate null hypothesis for a situation where we want to compare the difference
between males and females would be that there is no difference between them. The alternative
hypothesis would then be that the null hypothesis is wrong. The choice of alternative
hypothesis depends on the setting, and we'll explore a few examples later on. However, this
brief introduction leaves many unanswered questions.
It is crucial to draw the appropriate conclusion at the en d because our goal is to answer the
questions we find interesting. The result should demonstrate that we are outperforming
individuals who are making guesses at random.
Therefore, it is paramount to evaluate the data and the information gathered from vari ous
sources to formulate a valid conclusion.
Ultimately, arriving at a sound conclusion provides assurance that we have made progress
towards our goal of gaining knowledge about a particular subject matter.
Z Tests for One Mean: Introduction
There are two different scenarios when it comes to hypothesis testing. If the population standard
deviation, σ, is known, a z-test is used (although this is rare). However, if σ is unknown, we test the null
hypothesis that the population mean μ is equal to a hypothesized value μ0.
To test this null hypothesis, we use the test statistic:
z = x̄ - μ0 / σ̅x
This test statistic will have the standard normal distribution. For example, let's suppose a supplier to a
sushi restaurant claims their blue fin tuna contains no more than 0.4 parts per million of mercury on
average. If the 16 pieces of tuna had a mean of 0.74, we can see if this difference gives us strong
evidence against the null hypothesis. Visually, the observations look well above the hypothesized
mean value, but there is some variability involved.
, Hypothesis Testing
There is compelling evidence that the actual average amount of mercury in blue fin tuna obtained
from this supplier exceeds the claimed level of 0.4 parts per million. The observations we made would
be highly unlikely if the null hypothesis were valid. We have two options to proceed: the rejection
region method or the p-value method.
Formula:
Example:
Suppose we have a sample of 40 blue fin tuna and the sample mean mercury level is 0.44 parts per
million. Assume the population standard deviation is 0.06 parts per million. We want to test if the true
mean mercury level is greater than the claimed 0.4 parts per million. Using a significance level of 0.05
and assuming a normal distribution, we find that the critical z-value is 1.645. The test statistic is
calculated as:
Plugging in the values, we get:
Since 3.09 is greater than 1.645, we reject the null hypothesis and conclude that there is sufficient
evidence that the true mean mercury level is greater than 0.4 parts per million.
"The observed data would be highly unlikely if the null hypothesis were true."
Z Tests for One Mean: The Rejection Region Approach
The rejection region approach involves:
• Choosing a value for alpha which we call the significance level of the test.
• Alpha is the probability of rejecting the null hypothesis if it is true.
• The appropriate choice of alpha depends on the problem at hand.
• Then we're going to find the appropriate rejection region.
• If we get a value in the middle, we're going to not reject the null hypothesis.
If we keep the alpha level the same but change the alternative hypothesis to mu being less than mu_0,
then values of this test statistic that are in the left tail of the distribution give us evidence against the
null. And so for an alpha level of 0.05, we are going to reject the null hypothesis if the z value in our
sample is less than or equal to 1.645. If the z value that we observe is less than or equal to 2.33, we
can reject the null hypothesis at alpha = 0.05.
If we happen to get a z value of 1.6448, say, we would not reject the null hypothesis. If we got a z
value that was very huge, let's say, 17819, we have the same conclusions in these two situations, even
though this one has by a great deal more evidence against the null hypothesis.
Z Tests for One Mean: The p-value