Null and Alternate Hypothesis
Hypothesis testing is a statistical method for deciding, based on sample data, whether there's enough evidence to support a claim about a population. It always starts with defining two competing statements - the Null and Alternate Hypothesis.
Null Hypothesis (H0)
The default assumption - typically a statement of "no effect" or "no difference." It's what you assume to be true unless the data provides strong evidence against it.
Alternate Hypothesis (H1 or Ha)
The claim you're actually trying to find evidence for - it contradicts the null hypothesis and usually represents the effect or difference you suspect exists.
A Simple Example
A company claims a new website design increases the average time users spend on the page.
# H0: The new design has no effect on average time spent (mean is unchanged)
# H1: The new design increases the average time spent (mean is higher)
import numpy as np
from scipy import stats
old_design = np.array([30, 32, 28, 35, 31])
new_design = np.array([40, 38, 42, 36, 39])
t_stat, p_value = stats.ttest_ind(new_design, old_design)
print(t_stat, p_value)
How the Decision Is Made
You never "prove" the null hypothesis true - you either reject it in favour of the alternate hypothesis, if the evidence is strong enough, or fail to reject it, if the evidence isn't sufficient.
Coming Up Next
Next, you'll learn the Critical Value Method - one of the two main approaches used to test a hypothesis.