Hypothesis Testing
•Hypothesis testing is a fundamental concept in statistics used to make
inferences or draw conclusions about a population based on sample
data. Here’s a basic introduction to the process.
What is hypothesis testing..?
•Hypothesis testing is a method used to determine whether there is
enough evidence in a sample of data to infer that a certain condition
holds for the entire population. It involves comparing data against a
null hypothesis to see if there is enough evidence to support an
alternative hypothesis.
•A hypothesis test provides us with a statistical method so that we can
use our sample findings to make an inference [conclusion] about a
population
•The aim is to rule out sampling errors.
Hypothesis Testing
•Null Hypothesis (H₀): This is a statement of no effect or no difference,
and it represents the default or baseline position. It is what you
assume to be true unless evidence suggests otherwise.
•Example: If you are testing a new drug, the null hypothesis might be
that the new drug has the same effect as the current standard drug.
•Alternative Hypothesis (H₁ or Ha): This statement is what you want to
test for. It represents a new effect or difference that you suspect
might exist.
•Example: The alternative hypothesis could be that the new drug is
more effective than the current standard drug.
Hypothesis Testing
Steps in the process:
1.State hypothesis [what do we think is happening in the population?]
2. Use this hypothesis to predict the characteristics the sample should have
[e.gdirection of change] including the ‘critical region’
3. Obtain a sample from the population and calculate the sample statistic
4. Compare the sample data findings to the hypothesis to reach a conclusion
Hypothesis Testing
Steps in the process:
1.State hypothesis [what do we think is happening in the population?]
•Null and Alternative hypotheses
2. Use this hypothesis to predict the characteristics the sample should have [e.gdirection of change]
including the ‘critical region’
•Directional –direction of change [one-tailed test]
•Non-directional –think something has changed, but not sure how [two-tailed test]
•Alpha level [∝] to decide critical region [unlikely to occur if Null Hypothesis is true]
3. Obtain a sample from the population and calculate the sample statistic
•Collect some data!
•Introduction to z-statistic [one-sample z-test]
4. Compare the sample data findings to the hypothesis to reach a conclusion
•Is there sufficient evidence to convince us …
One –Tailed test
•A one-tailed test in hypothesis testing is used when you are interested
in detecting an effect or difference in only one direction. This type of
test evaluates whether a sample statistic falls into one specific tail of
the probability distribution, based on the alternative hypothesis.
•A one-tailed test is appropriate when you have a specific direction of
interest. It can test for either an increase or a decrease but not both.
•Left-Tailed Test : Null Hypothesis (H₀): The parameter is greater than
or equal to a certain value. For example, H₀: μ ≥ μ₀.
•Alternative Hypothesis (H₁ or Ha): The parameter is less than that
value. For example, H₁: μ < μ₀.
One –Tailed test
•Right-Tailed Test:
•Null Hypothesis (H₀): The parameter is less than or equal to a certain
value. For example, H₀: μ ≤ μ₀.
•Alternative Hypothesis (H₁ or Ha): The parameter is greater than that
value. For example, H₁: μ > μ₀.
One –Tailed test
•Example 1: Right-Tailed Test
•Scenario: A manufacturer claims that a new battery lasts 500 hours. You
want to test if the battery lasts longer than 500 hours.
•Null Hypothesis (H₀): The mean battery life is less than or equal to 500
hours. H₀: μ ≤ 500.
•Alternative Hypothesis (H₁): The mean battery life is greater than 500
hours. H₁: μ > 500.
•You perform a test, calculate the test statistic, and compare it to the critical
value for the right tail. If the test statistic falls in the right tail of the
distribution and the p-value is less than α (e.g., 0.05), you reject the null
hypothesis, suggesting that the battery life is significantly greater than 500
hours.
One –Tailed test
•Example 2: Left-Tailed Test
•Scenario: You are testing whether a new diet pill results in a reduction in
average weight loss compared to a standard diet pill. The standard pill has
been reported to cause a weight loss of 10 pounds.
•Null Hypothesis (H₀): The mean weight loss with the new pill is greater
than or equal to 10 pounds. H₀: μ ≥ 10.
•Alternative Hypothesis (H₁): The mean weight loss with the new pill is less
than 10 pounds. H₁: μ < 10.
•You perform the test, calculate the test statistic, and compare it to the
critical value for the left tail. If the test statistic falls in the left tail and the
p-value is less than α, you reject the null hypothesis, indicating that the
new pill results in significantly less weight loss than the standard pill.
Two –Tailed test
•A two-tailed test in hypothesis testing is used when you want to
determine if there is a significant difference or effect in either
direction from the null hypothesis. Unlike a one-tailed test, which
focuses on detecting changes in a specific direction, a two-tailed test
evaluates both possibilities whether the observed effect is either
significantly greater or less than the hypothesized value.
•A two-tailed test is appropriate when you want to test for deviations
in both directions from the null hypothesis. It evaluates whether the
sample data falls significantly in either tail of the distribution.
Two –Tailed test
•Null Hypothesis (H₀): The parameter of interest is equal to a specified
value. For example, H₀: μ = μ₀, where μ is the population mean and
μ₀ is a hypothesized value.
•Alternative Hypothesis (H₁ or Ha): The parameter of interest is not
equal to the specified value. For example, H₁: μ ≠ μ₀.
•The significance level (α) is the probability of rejecting the null
hypothesis when it is true (Type I error). In a two-tailed test, the
significance level is split between the two tails of the distribution.
•For a significance level of 0.05, the critical region is divided into two
tails, each with 0.025 (totaling 0.05).
Hypothesis testing –uncertainty / errors
Hypothesis testing is an inferential process
•Based on limited information to reach a conclusion
•That is, a sample provides limited / incomplete information about
the population, and yet a hypothesis test uses a sample to draw a
conclusion about the population
•Therefore, there is always the possibility that an incorrect
conclusion will be made …
•Two types of errors:
•Type I error (False Positives)
•Type II error (False Negatives)
Type I and Type II errors
Type I error:
–Rejecting H
0when it is true
• suggesting a difference when there is NO difference [False Positive]
Type II error:
–NOT rejecting H
0when it is false
• suggesting NO difference when there IS a difference [False Negative]
Hypothesis testing –Type I error –False
Positives
A Type I error occurs when a researcher rejects a null hypothesis that is actually true
•concludes that a treatment does have an effect / there is a difference /
relationship when in fact it has no effect / there is no difference / relationship
A Type I error occurs when a researcher unknowingly obtains an extreme, non-
representative sample
•Our hypothesis tests are structured to minimisethe risk that this type of error will
occur
•The alpha level for a hypothesis test is the probability that the test will lead to a
Type I error
•the alpha level is the probability of obtaining sample data in the critical region
even though the null hypothesis is true.
•If ∝= .05, then around 1/20 studies will show a significant effect, when it shouldn’t.
•As studies are assumed to require independent replication, we accept this error rate
Hypothesis testing –Type II error –False
Negatives
A Type II error occurs when a researcher fails to reject a null hypothesis that
is actually false
•concludes that there is no effect / difference / relationship when there
really is one
A Type II error occurs when the sample mean is not in the critical region even
though there is an effect / difference / relationship
•Usually occurs when the effect / difference is small
•The consequences of a Type II error are usually not as serious as a Type
I error
•A Type II error suggests that the means do not show the results
expected / hoped for by the researcher
Type I and Type II errors
H
0=NotPregrant
H
1=Pregrant
Do Not Reject H
0 Reject H
0
H
0 is TRUE
H
0 is FALSE
Correct Pregnant
Correct Not Pregnant Type I Error (False +’ve)
Type II Error (False -’ve)
Selecting an Alpha level
The main concern when selecting an alpha level is to minimize the risk
of a Type I error
•alpha levels tend to be very small probability values
•usual convention is that the largest permissible value is ∝= 0.05
However … as the alpha level is lowered [e.g., to 0.01 / 0.001] the
hypothesis test demands more evidence from the results and the risk
of making a Type II error increases