Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 36

Formulating Hypotheses

Recommended resources

Introduction

Welcome to the next stage of your journey into data science. In the previous module, we delved into Bayesian inference, culminating in a project where you implemented a sequential estimator. The core question was estimation: "What is the most likely value of this parameter?" We saw how our belief, represented by a probability distribution, could be updated as we gathered more data.

Today, we pivot to a different but related fundamental concept in statistics: Hypothesis Testing. We are moving from asking "What is the value?" to asking "Is the value something specific?" For instance, instead of estimating a coin's bias, we might ask, "Is this coin fair?" This lesson corresponds to the first learning outcome in the "Hypothesis Testing and Statistical Significance" module: Formulate null and alternative hypotheses for a given research question.

This is the foundational step for a suite of powerful techniques used across science and industry to make data-driven decisions. By the end of this lesson, you will be able to translate a real-world problem or a research question into the precise mathematical language of hypothesis testing.


1. The Framework of Hypothesis Testing

Hypothesis testing provides a formal procedure for deciding between two competing statements about a population, based on evidence from a sample. Think of it as the statistical equivalent of a legal trial.

In a courtroom, a defendant is presumed innocent until proven guilty. The prosecution must present compelling evidence to overturn this initial presumption. Hypothesis testing operates on a similar principle.

  • The Null Hypothesis () is the statement of "no effect," "no difference," or the status quo. It's the initial assumption, the statistical equivalent of "presumed innocent." It is the hypothesis that we are trying to find evidence against.
  • The Alternative Hypothesis ( or ) is the claim we want to establish. It represents the "research hypothesis" or the new theory we are testing. It's the statistical equivalent of "guilty."

The entire process revolves around assessing the strength of the evidence from our sample data against the null hypothesis. We ask: "If the null hypothesis were true, how likely is it that we would observe data like ours?" If this likelihood is very low, we reject the null hypothesis in favor of the alternative.

Let's start by reading a brief introduction to this concept.

Introduction to Hypothesis Testing

This document from Sage Publishing provides a clear, high-level overview of hypothesis testing. We'll focus on the first step, which defines and explains the role of the null and alternative hypotheses.

Please read 'Step 1: State the hypotheses' (part of Section 8.2) and the 'MAKING SENSE: Testing the Null Hypothesis' box. Pay close attention to the courtroom analogy and the definitions of H₀ and H₁.

To summarize the key idea from the reading:

  • Null Hypothesis (): A statement about a population parameter assumed to be true. It always contains a statement of equality ().
  • Alternative Hypothesis (): A statement that directly contradicts the null hypothesis. It never contains a statement of equality ().

The following image provides a concise visual summary of these two concepts.

Null vs. Alternative Hypothesis Comparison
This chart neatly summarizes the definitions, roles, and associated mathematical operators for the Null Hypothesis (H₀) and the Alternative Hypothesis (Hₐ).

2. Formulating Hypotheses: Types and Examples

The way we formulate our hypotheses depends on the research question. Specifically, it depends on whether we're looking for any difference or a difference in a specific direction. This leads to three types of tests.

To see how this is done in practice, let's watch a video that walks through several examples of translating a word problem into formal hypotheses.

Null and Alternate Hypothesis - Statistical Hypothesis Testing - Statistics Course

This video by Math and Science provides excellent, clear examples of how to read a problem statement and formulate the corresponding null and alternative hypotheses for means and proportions.

Watch the video from 00:39 to 11:11. This covers three distinct examples that illustrate the three main types of hypothesis tests. For each example, focus on how the wording of the problem ('no longer this size', 'no longer than', 'at least') directly translates into the mathematical symbols used in H₀ and Hₐ.

Let's formalize the three types of tests you saw in the video. Let be the population parameter of interest (e.g., mean) and be the specific value we are testing against.

a) Two-Tailed Test (Non-Directional)

This is used when we are interested if the parameter is simply different from a certain value. We don't specify the direction of the difference.

  • Research Question: "A machine is supposed to produce straws with a 4mm diameter. We want to test if the machine is out of calibration."
  • Hypotheses:
    • (The machine is correctly calibrated)
    • (The machine is not correctly calibrated)

This was the first example in the video. The alternative hypothesis covers both possibilities: and .

b) One-Tailed Test: Upper-Tailed (Right-Tailed)

This is used when we are interested if the parameter is greater than a certain value.

  • Research Question: "A researcher believes that teens sleep longer than 10 hours per day, contrary to the belief that they sleep no longer than 10 hours."
  • Hypotheses:
    • (The average sleep time is 10 hours or less)
    • (The average sleep time is more than 10 hours)

This was the second example in the video. The alternative hypothesis is the "research" claim that the researcher wants to prove.

c) One-Tailed Test: Lower-Tailed (Left-Tailed)

This is used when we are interested if the parameter is less than a certain value.

  • Research Question: "A teacher believes the school board's claim that at least 60% of students bring a phone is too high."
  • Hypotheses (for a proportion ):
    • (The proportion is 60% or more)
    • (The proportion is less than 60%)

This was the third example in the video. The teacher is trying to find evidence for their belief, which becomes the alternative hypothesis.

A Note on Formulation: In many texts and software implementations, the null hypothesis for one-tailed tests is often simplified to an equality (e.g., ). This is because the test is statistically performed at the boundary condition. The logic holds: if you can find evidence to reject that the mean is exactly 10 in favor of it being greater, you have implicitly found evidence that it's not less than 10. For clarity in formulation, it's best to use the inequality ( or ) as it more accurately reflects the full statement of the null.


3. Application: A/B Testing

A very common application of hypothesis testing in data science and technology is A/B testing. Imagine your EV company wants to know if changing the color of the "Book a Test Drive" button on the website from blue to green will increase clicks.

The A/B Testing Process
The A/B testing cycle is a practical application of the hypothesis testing framework in industry.

Here's how you'd formulate the hypotheses:

  • Let be the click-through rate for the original blue button (Version A).
  • Let be the click-through rate for the new green button (Version B).

The research question is: "Does the green button have a higher click-through rate?"

  • Null Hypothesis (): There is no improvement or the change is detrimental.
  • Alternative Hypothesis (): The green button is better.

This is an upper-tailed test. You would then collect data by showing different users the two versions, and use a statistical test to decide whether to reject and conclude that the green button is indeed superior.


4. Check Your Understanding

To solidify your understanding, translate the following research questions into null and alternative hypotheses. Define the parameter you are testing in each case.

  1. An R&D engineer claims that a new battery manufacturing process has reduced the average weight of a battery pack, which was previously 450 kg.
  2. A quality control department wants to verify that the resistance of a specific component is exactly 50 Ohms, as specified. Any deviation, higher or lower, is a problem.
  3. The marketing team launches a campaign, believing it will increase the proportion of visitors to the company website to more than the historical average of 5%.
Click to see the solutions
  1. Parameter: = the new average battery pack weight.

    • kg (The new process did not reduce the average weight).
    • kg (The new process did reduce the average weight).
    • Type: Lower-tailed test.
  2. Parameter: = the true average resistance of the component.

    • Ohms (The component meets the specification).
    • Ohms (The component does not meet the specification).
    • Type: Two-tailed test.
  3. Parameter: = the new proportion of website visitors.

    • (The campaign did not increase the proportion of visitors).
    • (The campaign successfully increased the proportion of visitors).
    • Type: Upper-tailed test.

Conclusion

In this lesson, we have taken the first crucial step into the world of hypothesis testing. You learned that this statistical framework is a formal process for making decisions from data, analogous to a courtroom trial.

Key Takeaways:

  • Null Hypothesis (): Represents the default assumption or "status quo." It always includes the equality condition ().
  • Alternative Hypothesis (): Represents the research claim or the effect you're trying to prove. It is the mathematical opposite of ().
  • Three Test Types: The formulation depends on the research question, leading to two-tailed (), upper-tailed (), or lower-tailed () tests.
  • Burden of Proof: The goal of a hypothesis test is to see if there is enough evidence in the sample data to reject the null hypothesis in favor of the alternative.

Preview of the Next Lesson:

Now that you can formulate hypotheses, the next logical question is: "How do we decide whether to reject the null hypothesis?" In the next lesson, we will begin to answer this by exploring one of the most fundamental and powerful methods for constructing a statistical test. You will learn to derive the Likelihood Ratio Test (LRT) statistic for simple hypotheses. This will link today's topic with the concept of likelihood that you have encountered before, providing a principled way to quantify the evidence for one hypothesis over another.