Hypothesis Testing Framework
- 35Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is the null hypothesis (H₀)?
The boring status quo or default reality that you assume to be true until evidence suggests otherwise.
Or swipe the card
35 cards
What is the null hypothesis (H₀)?
The boring status quo or default reality that you assume to be true until evidence suggests otherwise.
What is the alternative hypothesis (H₁)?
The exciting new theory you want to prove, representing a real effect or difference.
What is alpha (α) in hypothesis testing?
The significance level, or the maximum risk you are willing to take of being wrong (Type I error). Typically set at 0.05.
What is a p-value?
The probability of observing your data (or something more extreme) if the null hypothesis is true.
What is the universal decision rule in hypothesis testing?
If p < α, reject H₀. If p ≥ α, fail to reject H₀.
What are the four steps of the universal hypothesis testing algorithm?
- Formulate (define H₀ and H₁). 2. Calibrate (set α). 3. Compute (calculate test statistic and p-value). 4. Decide (compare p to α).
In the coin flip example (9 heads in 10 flips), how is the p-value calculated under the null hypothesis of a fair coin?
P(9 heads) = 10 × 0.510 = 0.00977; P(10 heads) = 0.510 = 0.000977; total p = 0.00977 + 0.000977 = 0.0107.
What is the p-value for getting 9 heads in 10 flips of a fair coin?
0.0107 (1.07%).
How do the intuitive steps of the coin test map to formal hypothesis testing terms?
'Assume coin is fair' = null hypothesis (H₀); 'coin is rigged' = alternative hypothesis (H₁); calculated probability = p-value; 5% threshold = α.
What Python code performs a binomial test for 9 heads in 10 flips?
scipy.stats.binom_test(k=9, n=10, p=0.5, alternative='greater')returns p = 0.0107.What is the difference between discrete and continuous data?
Discrete data is countable (e.g., number of heads). Continuous data can take any value (e.g., time, weight, revenue).
What is the Central Limit Theorem (CLT)?
The distribution of sample means approaches a normal distribution as sample size increases, regardless of the population's shape.
What is the formula for the Z-test statistic?
Z=σ/nxˉ−μ where xˉ is sample mean, μ is population mean under H₀, σ is population standard deviation, n is sample size.
How is the Z-test interpreted as signal vs noise?
Signal = xˉ−μ (how far off from target); Noise = σ/n (standard error); Z = signal/noise.
In the chip factory example (target 100g, σ=5, n=50, xˉ=102), what are the Z-score and p-value?
Z = (102-100)/(5/√50) ≈ 2.83; p ≈ 0.0047 (two-tailed).
What Python code computes the p-value for a Z-test?
Compute
z = (xbar - mu) / (sigma / sqrt(n)), thenp = 2 * norm.cdf(-abs(z))fromscipy.stats.norm.What is the limitation of the Z-test?
It requires knowing the population standard deviation σ, which is often unknown in practice.
When should you use a two-sample t-test instead of a Z-test?
When the population standard deviations are unknown and must be estimated from the samples.
What is the formula for the two-sample t-test (independent, unequal variances)?
t=n1s12+n2s22xˉ1−xˉ2
In the button test (A: mean=45, sd=15, n=10; B: mean=55, sd=15, n=10), what is the t-statistic and p-value?
t = (55-45) / √(15²/10+15²/10) ≈ 10/6.71 ≈ 1.49; p ≈ 0.15.
What are two ways to increase power in a t-test?
- Increase the signal (make the difference larger). 2. Increase the sample size (reduce the noise).
What Python function performs an independent two-sample t-test?
scipy.stats.ttest_ind(group_a, group_b)returns t-statistic and p-value.What is the chi-square test used for?
Testing for association between categorical variables, e.g., comparing conversion rates between two groups.
What is the logic behind the chi-square test?
Compare observed frequencies (O) to expected frequencies (E) under the null. A big gap suggests a real effect.
What is the chi-square test formula?
χ2=∑E(O−E)2 where O is observed count and E is expected count.
In the red button test (blue: 10/100 buy, red: 20/100 buy), what are the expected counts under the null hypothesis?
Overall conversion = 30/200 = 15%. Expected: blue buy = 15, blue not buy = 85; red buy = 15, red not buy = 85.
What are the chi-square value and p-value for the red button test?
χ2 = 3.92, p = 0.0477.
What Python code performs the chi-square test for the red button example?
scipy.stats.chi2_contingency([[10,90],[20,80]])returns χ2 = 3.92, p = 0.0477.Why is the chi-square result sensitive to small changes in data?
One observation change (e.g., from 20 to 19 buys) can change p from significant (0.0477) to not significant (0.0763).
What is the decision matrix for choosing a hypothesis test (based on data type and knowledge of standard deviation)?
Categorical data: chi-square test for conversion. Continuous data, unknown σ: two-sample t-test. Continuous data, known σ: one-sample Z-test.
What is p-hacking?
Repeatedly checking p-values during an experiment and stopping early when results become significant.
How do you avoid p-hacking?
- Pre-commit to a sample size. 2. Run the test fully without peeking. 3. Check p-value only once at the end.
What is the difference between statistical significance and practical significance?
Statistical significance: the effect is unlikely due to chance (p < α). Practical significance: the effect size is large enough to matter in practice.
Why can large sample sizes be problematic for practical significance?
Very small effects (e.g., 0.001 second improvement) can be statistically significant with huge samples, but are too small to matter.
What two things must you check before making a decision from a hypothesis test?
The p-value (statistical significance) and the effect size (practical significance).

Ask anything
We've read this whole study set, so questions about it get the best answers.