Hypothesis Testing Framework
- 43Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is the null hypothesis (H0) in hypothesis testing?
43 questions
- 1
What is the null hypothesis (H0) in hypothesis testing?
Model answer
The null hypothesis is the default or status quo, representing the boring reality that there is no effect or difference.
Explanation
In the content, H0 is described as 'the boring status quo, the default reality'.
- 2
What is the alternative hypothesis (H1)?
Model answer
The alternative hypothesis is the exciting new theory you want to prove, such as a real effect or difference.
Explanation
H1 is the opposite of H0, representing the effect you suspect is true.
- 3
What does alpha (α) represent in hypothesis testing?
Model answer
Alpha is the significance level, the maximum risk you are willing to take of being wrong (commonly set at 0.05).
Explanation
Alpha is your BS threshold; you compare it with the p-value to make a decision.
- 4
What does the p-value represent?
Model answer
The p-value is the probability of observing your data (or something more extreme) if the null hypothesis is true.
Explanation
A low p-value indicates that the observed result is unlikely under the null, suggesting evidence against H0.
- 5
What is the universal decision rule in hypothesis testing?
Model answer
If the p-value is less than alpha, reject the null hypothesis; otherwise, fail to reject the null.
Explanation
This rule is the core of hypothesis testing: p < α leads to rejecting H0.
- 6
List the four steps of the universal hypothesis testing algorithm.
Model answer
- Formulate (define H0 and H1), 2. Calibrate (set alpha), 3. Compute (calculate test statistic and p-value), 4. Decide (compare p to alpha).
Explanation
These steps form the universal algorithm that applies to all hypothesis tests.
- 7
What happens during the formulate step?
Model answer
You define the null hypothesis (H0) and the alternative hypothesis (H1).
Explanation
This step sets up what you are testing: the boring theory vs. the exciting theory.
- 8
What happens during the calibrate step?
Model answer
You set the significance level alpha (e.g., 0.05), which determines how much evidence you need to reject H0.
Explanation
Calibrating means choosing your BS threshold before looking at the data.
- 9
What happens during the compute step?
Model answer
You calculate the test statistic (like Z, t, or chi-square) and then convert it to a p-value.
Explanation
This step quantifies how far your data is from the null hypothesis.
- 10
What happens during the decide step?
Model answer
You compare the p-value to alpha: if p < α, reject H0; otherwise, fail to reject H0.
Explanation
This is the moment of truth where you make a decision based on the evidence.
- 11
What is the formula for the Z test statistic?
Model answer
Z=Ļ/nāxĖāμā, where xĖ is the sample mean, μ is the null hypothesized mean, Ļ is the population standard deviation, and n is the sample size.
Explanation
The formula measures how many standard deviations the sample mean is from the null mean.
- 12
What does the numerator of the Z test statistic represent?
Model answer
The numerator, xĖāμ, is the signal ā how far the sample result is from the null hypothesis.
Explanation
Signal is the observed deviation from the expected under H0.
- 13
What does the denominator of the Z test statistic represent?
Model answer
The denominator, Ļ/nā, is the standard error ā the amount of normal variation (noise) expected in sample means.
Explanation
Standard error quantifies how much sample means typically vary due to random chance.
- 14
What is the Central Limit Theorem?
Model answer
The Central Limit Theorem states that the sampling distribution of the sample mean is approximately normal, regardless of the population distribution, given a sufficiently large sample size.
Explanation
This theorem justifies using the Z test even when the underlying data are not normally distributed.
- 15
In the chip factory example, what were the null and alternative hypotheses?
Model answer
H0: the true mean weight μ=100 g (machine is fine); H1: μī =100 g (machine is broken).
Explanation
The null is that the machine is working correctly; the alternative is that it is off target.
- 16
In the chip factory example, the sample mean was 102 g, population sigma was 5 g, and sample size was 50. What was the calculated Z value?
Model answer
Z=5/50ā102ā100āā2.83.
Explanation
The signal is 2, the standard error is about 0.707, giving Z ā 2.83.
- 17
What was the conclusion in the chip factory example?
Model answer
Reject H0: the machine is broken, because the p-value (approximately 0.0047) was less than alpha (0.05).
Explanation
The p-value being very small indicates the observed 2 g deviation is unlikely to be due to chance alone.
- 18
Why is the t test often used instead of the Z test in practice?
Model answer
The t test is used when the population standard deviation is unknown and must be estimated from the sample, which adds extra uncertainty.
Explanation
In most real-world scenarios, sigma is not known, so the t test with sample standard deviation is more appropriate.
- 19
What is the formula for the two-sample t test statistic (assuming equal sample sizes)?
Model answer
t=nBāsB2āā+nAāsA2āāāxĖBāāxĖAāā
Explanation
The numerator is the signal (difference in means), and the denominator is the standard error (combined noise from both samples).
- 20
In the new button example, what were the sample means and standard deviations?
Model answer
Group A (old button): mean = 45 seconds, s = 15; Group B (new button): mean = 55 seconds, s = 15; both n = 10.
Explanation
The observed difference was 10 seconds, with variability measured by sample standard deviations.
- 21
What was the calculated t-value and p-value in the new button example?
Model answer
t ā 1.49, p ā 0.15.
Explanation
With a signal of 10 and noise of about 6.71, the t-value was not large enough to achieve statistical significance.
- 22
What was the conclusion in the new button example?
Model answer
Fail to reject H0: the 10-second improvement is not statistically significant; it could be due to random noise.
Explanation
Since p (0.15) > alpha (0.05), there is not enough evidence to conclude the new button is better.
- 23
What two levers can increase the chances of getting a significant t test result?
Model answer
Increase the effect size (signal) or increase the sample size (reduce noise).
Explanation
A larger signal-to-noise ratio leads to a larger t-value and lower p-value.
- 24
How does increasing sample size affect the t statistic?
Model answer
Increasing sample size reduces the standard error (noise), which increases the t-value and makes it easier to detect a true effect.
Explanation
Larger samples provide more precise estimates, shrinking the denominator in the t formula.
- 25
What Python function is used to perform a two-sample t test?
Model answer
scipy.stats.ttest_ind(groupA, groupB)Explanation
This function calculates the t statistic and p-value for independent groups.
- 26
What is the key idea behind the chi-square test?
Model answer
The chi-square test compares observed frequencies (O) to expected frequencies (E) under the null hypothesis; a large gap suggests a real effect.
Explanation
It measures how far the observed data deviates from what would be expected if the null were true.
- 27
What is the chi-square test statistic formula?
Model answer
Ļ2=āE(OāE)2ā
Explanation
Each cell contributes its squared difference normalized by the expected count; these are summed across all cells.
- 28
In the red button test (blue vs. red button), what were the observed frequencies?
Model answer
Blue button: 10 bought, 90 did not; Red button: 20 bought, 80 did not.
Explanation
The observed table shows raw counts from the experiment.
- 29
How were the expected frequencies calculated in the red button test?
Model answer
Overall conversion rate was 30/200 = 15%, so expected for each group is 15% of 100: 15 bought and 85 did not.
Explanation
Under H0 (no color effect), both groups should have the same conversion rate equal to the overall rate.
- 30
What was the chi-square value and p-value in the red button test?
Model answer
Ļ2ā3.92, p ā 0.0477.
Explanation
The p-value is just below 0.05, leading to rejection of H0.
- 31
What was the conclusion in the red button test?
Model answer
Reject H0: the red button has a significantly higher conversion rate (20% vs. 10%).
Explanation
Since p < 0.05, the observed difference is unlikely to be due to chance alone.
- 32
Why do categorical data tests (like chi-square) require large sample sizes?
Model answer
Because categorical data is low resolution (yes/no), it contains less information per observation, so you need many observations to reliably detect differences.
Explanation
A small change in the number of successes can flip the conclusion, as shown by the red button example where one less sale made the result non-significant.
- 33
What Python function performs a chi-square test for independence?
Model answer
scipy.stats.chi2_contingency(observed_table)Explanation
This function takes a contingency table and returns the chi-square statistic, p-value, and other information.
- 34
When should you use a chi-square test?
Model answer
When you have categorical data and want to compare conversion rates or proportions between groups.
Explanation
For binary outcomes like click/no-click, the chi-square test is appropriate.
- 35
When should you use a two-sample t test?
Model answer
When you have continuous data (e.g., time, revenue) and want to compare the average of two groups, and you do not know the population standard deviation.
Explanation
The t test handles the uncertainty from estimating the standard deviation from the sample.
- 36
When should you use a one-sample Z test?
Model answer
When you have continuous data, a known population standard deviation, and you want to test if the sample mean differs from a target value.
Explanation
This is common in manufacturing or scientific settings where historical sigma is available.
- 37
What is p-hacking?
Model answer
P-hacking is repeatedly checking the p-value during an experiment and stopping early when significance is reached, which invalidates the test's validity.
Explanation
P-values are noisy early on; peeking inflates the chance of a false positive.
- 38
Why is peeking at test results a problem?
Model answer
Peeking allows random fluctuations to artificially cross the significance threshold, making the p-value unreliable and increasing false positives.
Explanation
The math behind hypothesis testing assumes a fixed sample size; peeking violates that assumption.
- 39
What is the professional solution to avoid p-hacking?
Model answer
- Pre-commit to a sample size. 2. Run the test without peeking. 3. Decide once at the end when the desired sample is reached.
Explanation
This ensures the validity of the statistical inference.
- 40
What is the difference between statistical significance and practical significance?
Model answer
Statistical significance means the effect is likely real (p < α), while practical significance means the effect is large enough to matter in the real world.
Explanation
A tiny effect can be statistically significant with a huge sample size but may have no practical value.
- 41
How does a very large sample size affect significance tests?
Model answer
A very large sample size can make even a tiny, trivial effect statistically significant because it reduces noise and increases power.
Explanation
The Google example shows a 0.001 second improvement was significant but not practically meaningful.
- 42
What should you always check in addition to the p-value before making a decision?
Model answer
You should also check the effect size to determine if the effect is big enough to care about.
Explanation
Combining statistical significance with practical significance ensures a good decision.
- 43
Why is effect size important in hypothesis testing?
Model answer
Effect size tells you the magnitude of the effect, helping you assess whether it is meaningful and worth acting on, beyond just being statistically significant.
Explanation
A statistically significant result may be too small to be practically useful, so effect size provides context.

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