liveBook · Manning

Alternative hypothesis

As explained in Grokking Statistics

A hypothesis that challenges the null hypothesis by asserting a different population value or relationship.

An alternative hypothesis is the competing claim in a hypothesis test: it says the population may differ from the status quo described by the null hypothesis. Write it as Ha. For a soda can advertised as 305 mL, H0 says the mean is about 305 mL; Ha says the claim does not hold. The question is not whether every individual can is exactly 305 mL, but whether sample data give strong reason to challenge the advertised population mean. section 6.0 section 6.15

Ha is considered when the data are sufficiently unlikely under H0. That wording matters: rejecting H0 does not prove or “accept” Ha with certainty. A very small probability can still describe an event that happened by chance, and other explanations may remain possible. Hypothesis tests provide evidence for challenging a claim, not an automatic truth machine. section 6.1 section 6.15

Choose Ha to match the question before looking for a result:

  • Use a two-tailed alternative, Ha: parameter ≠ value, when any departure matters. It asks whether the mean chip-bag weight differs from 142 g, whether higher or lower. section 6.6 section 6.15
  • Use a left-tailed alternative, Ha: parameter < value, when the question specifically concerns a decrease, such as bags weighing less than 142 g on average. section 6.8
  • Use a right-tailed alternative, Ha: parameter > value, when only an increase is the claim being investigated. section 6.15
  • Make H0 and Ha mutually exclusive opposites. A directional choice narrows the question and deliberately considers only one direction. section 6.6 section 6.8

Are the chip bags really 142 g?

A sample of 41 bags has a mean weight of 140.2 g and a standard deviation of 4.79 g. If the practical question is simply whether the advertised mean is wrong, frame H0: μ = 142 and Ha: μ ≠ 142. The sample mean alone is not enough: factory variation could produce a difference by chance. Calculate a test statistic, then reject H0 only if it falls in the critical region or its p-value is below α. If not, fail to reject H0; that means the sample lacks enough evidence of a different mean, not that 142 g has been proven true. section 6.6 section 6.15

The same structure applies beyond means. For Pearson correlation, H0 states that two variables have no linear correlation, r = 0, while Ha states that a linear correlation exists, r ≠ 0. A p-value from SciPy’s pearsonr helps assess whether data as extreme as the observed relationship would be surprising if the variables were uncorrelated. section 7.3

from scipy.stats import pearsonr
import numpy as np

x = np.array([ 51.5,  55.1,  63.0,  71.2,  73.0 ,
              77.1,  88.1,  91.2,  93.0, 101.6])

y = np.array([100.98, 137.44, 237.8 , 254.96, 263.45,
             353.89, 450.32, 521.34, 503.13, 573.91])

r, p = pearsonr(x, y)
print(f"Pearson correlation (SciPy): {r:.4f},"  #1
     f" p-value: {p:.10f}")  #1

if p < 0.05:  #2
   print("Reject the null hypothesis")  #2
else:  #2
   print("Fail to reject the null hypothesis")  #2

This runnable SciPy example computes a Pearson correlation and p-value, then uses a 0.05 threshold to reject or fail to reject the no-correlation null hypothesis. section 7.3

How Grokking Statistics covers it

How deep it goes
Defines Ha, contrasts directional forms, and applies rejection rules without deriving test distributions.
Examples
Uses soda volumes, tea-order guessing, chip-bag weights, and sports-drink sales versus temperature.
What it assumes
Teaches hypothesis claims from everyday examples while using sample means, standard deviations, and probabilities.
What you can do after
Evaluate/understand whether sample evidence supports rejecting a stated null hypothesis for a mean or correlation.
How it connects
Connects null hypothesis, p-values, significance level, critical regions, t-distribution, and Pearson correlation.

Also explained in

Compare how 3 books explain alternative hypothesis →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Statistics. The section links point to the parts of the book it draws on.