After exploring your data using summary statistics and visualizations, you often want to ask more specific questions. Perhaps you've noticed a difference between two groups in your data, or maybe you have a theory about how something works that you want to test. This is where the concept of hypothesis testing comes into play. It provides a formal framework for making decisions based on data.
Think of a hypothesis as a precise, testable statement about something you want to investigate. It's more specific than a general question. For instance, instead of asking "Is website design A better than design B?", a hypothesis might be "Website design A results in a higher average click-through rate than website design B."
In statistical hypothesis testing, we typically frame the problem using two competing statements:
The Null Hypothesis (H0): This is usually a statement of "no effect," "no difference," or the status quo. It represents a default assumption that we tentatively hold. In our website example, the null hypothesis would be:
The Alternative Hypothesis (Ha or H1): This is the statement that contradicts the null hypothesis. It represents what we suspect or hope might be true – often the presence of an effect or a difference. It's the claim we are trying to find evidence for. For the website example, the alternative hypothesis could be:
The core idea is not to prove the alternative hypothesis directly. Instead, we examine the evidence from our data (using the statistics we learned about, like means and standard deviations) to see how likely it is that we would observe our data if the null hypothesis were actually true.
Imagine a simplified scenario: We believe a coin is fair (H0: Probability of heads = 0.5). We flip it 10 times and get 9 heads (Ha: Probability of heads > 0.5). Does this result provide strong evidence against the coin being fair?
Hypothesis testing uses statistical calculations to quantify this evidence. If our observed data (e.g., 9 heads out of 10 flips, or a large difference in average click-rates between website designs) is very unlikely to occur by random chance alone assuming the null hypothesis is true, we might decide to reject the null hypothesis in favor of the alternative.
Think of it like a courtroom trial:
The prosecution needs to present strong evidence (data analysis results) to convince the jury to reject the assumption of innocence. We don't prove guilt absolutely; we determine if there's enough evidence to reject innocence "beyond a reasonable doubt" (which corresponds to a concept called statistical significance in testing). If the evidence isn't strong enough, we "fail to reject" the null hypothesis (like an acquittal) – which doesn't mean the defendant is innocent, just that there wasn't enough proof for guilt.
You won't be performing complex hypothesis tests in this introductory course, but understanding the underlying concept is fundamental in data science:
For now, the goal is to grasp the idea: we start with a default assumption (null hypothesis), state what we're trying to find evidence for (alternative hypothesis), and then use data to see if the evidence is strong enough to make us doubt our initial assumption. The summary statistics and distributions you've learned about are the building blocks used to measure that evidence in practice. The next hands-on practical will reinforce calculating some of these foundational statistics.
© 2025 ApX Machine Learning