Lesson 103 — Hypothesis testing: structure and logic
Formal structure of hypothesis testing: H0 vs H1, test statistic, p-value, significance level, Type I and Type II errors, and test power.
Used in: 3.º ano do EM (17-18 anos) · Equiv. Stochastik LK alemão · Equiv. Math B japonês · H2 Statistics singapurense
The p-value measures the probability of observing a result as extreme or more extreme than what was obtained, assuming that is true. When , the data are incompatible with at the chosen significance level, and we reject .
Rigorous notation, full derivation, hypotheses
Rigorous definition
The five elements of a hypothesis test
"The null hypothesis represents a claim of skepticism. It is the status quo that would be maintained unless there is sufficient evidence against it." — OpenIntro Statistics, §5.1
Errors and test power
Formal definition of p-value
"The p-value measures how consistent the data are with . A small p-value indicates that the data are incompatible with — not that is false with probability ." — OpenIntro Statistics, §5.1
Types of alternative hypothesis
Worked examples
Exercise list
42 exercises · 10 with worked solution (25%)
- Ex. 103.1ApplicationAnswer key
A consumer protection agency wants to check whether the average weight of a 500 g flour package is as stated. Formulate the hypotheses and for this scenario.
Show solution
g (weight as claimed), g (two-tailed, since weight can be above or below). Two-tailed test because both overweight and underweight are concerns. - Ex. 103.2ApplicationAnswer key
Researchers want to check whether Brazilian teenagers sleep less than the recommended 8 hours per night. Formulate and .
Show solution
hours (sufficient sleep), hours (insufficient sleep). One-tailed test to the left because the concern is with sleep below the recommended amount. - Ex. 103.3Application
, . Data: , , (known). Calculate the z-statistic and p-value. Conclude for .
Show solution
. Two-tailed p-value: . Since , we fail to reject . Insufficient evidence that the mean changed. - Ex. 103.4Application
A manufacturer claims its light bulbs last an average of 1000 h. A sample of bulbs gives h with h (known). At the 5% level, is the mean lifetime less than claimed?
Show solution
. One-tailed p-value . We reject : evidence that the mean lifetime is less than 1000 h.Show step-by-step (with the why)
- Hypotheses: h, h (one-tailed to the left).
- Statistic: .
- One-tailed p-value: .
- Since , we reject .
- Shortcut: For one-tailed tests, p-value is half the two-tailed p-value for the same . Here two-tailed would be 0.0164, one-tailed is 0.0082.
- Ex. 103.5Application
In a criminal trial, is "the defendant is innocent" and is "the defendant is guilty." Describe Type I and Type II Errors in this context. Which is considered more serious in the Brazilian legal system? Why?
Show solution
Type I Error: convict an innocent (legal system says "guilty" when actually innocent). Type II Error: acquit a guilty person (system says "innocent" when actually guilty). In a democratic legal system, Type I is more serious because "it is better to acquit 100 guilty people than to convict 1 innocent" — the requirement level ("beyond reasonable doubt") is very high, equivalent to very small . - Ex. 103.6Understanding
A test yields . Which statement below is correct?
Show solution
The p-value is a probability about the data (given ), not about hypotheses. The correct interpretation is always: "probability of observing a result as extreme or more extreme, assuming is true". - Ex. 103.7Understanding
A test with yields . The researcher concludes "the effect does not exist." What may be wrong?
Show solution
Failing to reject does not mean is true. The effect may exist but the sample may be too small (insufficient power) to detect it. Absence of evidence is not evidence of absence. - Ex. 103.8Application
A school implemented a new methodology. The historical average score is points. After intervention, students achieved and (known). At the 5% level, did the score improve?
Show solution
points, (one-tailed to the right). . p-value: . Since , we fail to reject at the 5% level. Marginally non-significant. - Ex. 103.9Application
An urgent care center wants to detect a 5 min reduction in response time (, ). With and 90% power, what is the minimum ?
Show solution
visits.Show step-by-step (with the why)
- n = (z_{\alpha/2} + z_{eta})^2 \sigma^2/\delta^2.
- min, min, , 90% power: .
- .
- Round: visits.
- Shortcut: Increasing power from 80% to 90% adds approximately 30% to sample size ( vs ).
- Ex. 103.10ApplicationAnswer key
A coin is flipped 100 times and lands heads 60 times. At the 5% level, is the coin fair?
Show solution
(fair coin), . Statistic: . Two-tailed p-value: . We reject : evidence that the coin is biased. - Ex. 103.11Application
A researcher changes the significance level from to while keeping fixed. Explain the effect on Type II Error and test power.
Show solution
For fixed and , decreasing from 0.05 to 0.01 increases the critical value, shrinking the rejection region. This increases (harder to reject when false) and reduces power. The fundamental trade-off: fewer false positives means more false negatives for fixed . - Ex. 103.12Application
Normal fasting glucose level: mg/dL. A sample of diabetic patients gives mg/dL with mg/dL. At the 1% level, is average glucose elevated?
Show solution
mg/dL, mg/dL. . p-value: . We reject : strong evidence that average blood glucose is above normal. - Ex. 103.13Understanding
A result is "statistically significant at 5%." What does this correctly mean?
Show solution
"Statistically significant" only means the p-value fell below . It does not imply practical relevance, causality, or absence of bias. With very large , trivial differences become "significant". - Ex. 103.14Application
A company wants to detect whether the average weight of its products fell from g to g, with g, , and 80% power. What is the minimum ?
Show solution
g, g (one-tailed). With g and , critical value: . To detect g with 80% power: . - Ex. 103.15ApplicationAnswer key
A genomics study performs 1000 simultaneous tests with . All tested genes are null (no true effect). How many false positives are expected? If 60 genes are "significant," what is the estimated false discovery rate?
Show solution
Significance level 5%: reject if . In 1000 tests, expect false positives. If only 60 are significant and all are true positives, estimated FDR = 50/60 = 83%. Most "discovered" effects may be false. - Ex. 103.16Application
A coin is flipped 800 times and lands heads 384 times. At the 5% level, is the coin fair?
Show solution
. Two-tailed p-value: . Since , we fail to reject . The data are consistent with a fair coin. - Ex. 103.17Application
A survey of teenagers recorded average sleep of h with h (from prior studies). At the 5% level, do they sleep less than 8 hours?
Show solution
, p-value . We reject : evidence that teenagers sleep less than 8 hours.Show step-by-step (with the why)
- Hypotheses: h, h.
- Statistic: .
- One-tailed p-value: .
- Since , we reject . Teenagers sleep significantly less than 8 hours.
- Note: p = 0.034 is close to 0.05. A responsible researcher would report the exact value, not just "significant." With we would not reject.
- Ex. 103.18Understanding
Which statement about statistical significance is correct?
Show solution
With very large , tiny differences become "statistically significant." The p-value depends on both the effect size AND the sample size. With , an effect of 0.001 units may have but be clinically irrelevant. - Ex. 103.19Modeling
A clinical trial tests 20 endpoints simultaneously with . What is the probability of at least one false positive without correction? Describe how Bonferroni correction solves the problem and discuss its limitation.
Show solution
FWER with Bonferroni correction: uses per test. Controls the FWER at 5%. Alternative: FDR (Benjamini-Hochberg) is more powerful when many effects are expected. In the clinical trial with 20 endpoints, Bonferroni may be excessively conservative if endpoints are correlated — the Holm-Bonferroni method is considered a compromise. - Ex. 103.20Application
The historical ENEM pass rate at a school is 30%. After a new methodology, 38 of 100 students passed. At the 5% level, did the rate improve?
Show solution
(historical approval rate), . . . p-value: . Since , we reject : the new methodology appears to improve approval rate. - Ex. 103.21Application
Test vs with and . Calculate the p-value for and . What does this reveal about p-value and effect size?
Show solution
With : . Two-tailed p-value: . Do not reject. With : . . Reject with certainty. A difference of 1 unit: trivial with , "highly significant" with . Illustrates that p-value measures incompatibility with , not effect size. - Ex. 103.22ApplicationAnswer key
Normal systolic pressure: mmHg. Sample of sedentary adults: mmHg, mmHg. At the 1% level, is average pressure elevated?
Show solution
mmHg, . . p-value: . We reject : strong evidence that average blood pressure is elevated in the sample. - Ex. 103.23ApplicationAnswer key
A veterinary study wants to detect that the average weight of pigs of a breed changed from 125 kg to 120 kg (, ). With two-tailed and 80% power, how many animals are needed?
Show solution
animals.Show step-by-step (with the why)
- To detect kg vs kg with : .
- 80% power: z_{eta} = 0.842. Two-tailed 5% level: .
- . Round: .
- Shortcut: The formula n = (z_{\alpha/2} + z_{eta})^2 \sigma^2/\delta^2 shows that sample size scales quadratically with (inverse signal-to-noise ratio).
- Ex. 103.24Modeling
ENEM at a school has points against from state average, with and students. The result is "highly significant" (). Calculate Cohen's effect size . Is a 2-point difference educationally relevant? Discuss.
Show solution
Cohen's effect size: (small effect by Cohen's convention). With , even generates . In educational research, a 2-point difference on a 100-point scale may not justify policy change, despite "significance." Reporting confidence intervals and effect size is essential. - Ex. 103.25Challenge
Show that, under true, the p-value has Uniform distribution for continuous tests. Use this result to verify that .
Show solution
Under true, the p-value has distribution . Therefore exactly — the level controls Type I error rate exactly. Under , the p-value distribution concentrates near 0, with the fraction below equal to power . - Ex. 103.26Proof
Use the Neyman-Pearson Lemma to show that the one-tailed z-test (reject if ) is the most powerful level test for vs with normal data and known.
Show solution
The optimal rejection region by Neyman-Pearson Lemma for vs with normal data is: reject if where is determined by . This is equivalent to the one-tailed z-test. Proof: the likelihood ratio is monotonically increasing in for . - Ex. 103.27Application
An organization reported that teenagers spent an average of 4.5 hours weekly on their phones. You believe the current average is higher. Formulate and and justify the test type (one-tailed/two-tailed).
Show solution
hours, (one-tailed — you believe usage has increased). One-tailed test to the right because the interest is in whether current average exceeds the historical value. - Ex. 103.28Application
Researchers study app usage among 273 teenagers: 63 use the app. They test whether more than 30% of teenagers use the app. Formulate and , then describe Type I and Type II Errors in this context.
Show solution
, . Type I Error: conclude that more than 30% use the app when actually they do not. Type II Error: fail to detect that more than 30% use the app when they actually do. - Ex. 103.29Application
Engineers at a start-up work an average of 60 hours per week. A new hire suspects the average is less. Surveys 10 colleagues and obtains: 70, 45, 55, 60, 65, 55, 55, 60, 50, 55 hours. At the 5% level, is the average less than 60?
Show solution
One-tailed test to the left: , . Sample of 10 engineers: hours worked = 70, 45, 55, 60, 65, 55, 55, 60, 50, 55. , . . p-value: . Do not reject at . - Ex. 103.30Application
A Gallup survey indicates that 40% of Americans fear public speaking. A student believes the percentage at her school is lower. She surveys 361 peers and 141 report fearing public speaking. At the 5% level, is the proportion less than 40%?
Show solution
, . . . p-value: . We fail to reject : no evidence that the proportion at the school is less than 40%. - Ex. 103.31ApplicationAnswer key
The average US career length before retirement is 34 years. Formulate hypotheses to test whether this mean still holds. Describe Type I and Type II Errors and their practical consequences.
Show solution
years of work before retirement, . Type I Error: wrongly claim the mean is not 34 years. Type II Error: fail to detect that the mean has changed when it truly did.Show step-by-step (with the why)
- Hypotheses: years, years (two-tailed).
- With years (known): .
- If and are not specified, recognize that for the stated mean of 34 years, the test would be two-tailed with rejection if at 5%.
- Type I Error is concluding the mean differs from 34 when it actually equals 34 (false alarm). Type II Error is failing to reject when the mean truly differs from 34 (missing a real effect).
- Ex. 103.32Application
National data show that 68% of online courses at community colleges are taught by full-time faculty. A researcher tests if this applies to California. Surveys 45 instructors at LBCC: 34 are full-time. At the 5% level, is there evidence of a difference?
Show solution
, . . . Two-tailed p-value: . We fail to reject : no evidence that the proportion in California differs from 68%. - Ex. 103.33Understanding
Which statement about the p-value is correct?
Show solution
The p-value is . It depends on the observed effect AND the sample size. With very large , tiny effects become "significant." The p-value does not measure practical relevance nor the probability of being true. - Ex. 103.34ApplicationAnswer key
A city had 14% of residents who walked for exercise. This year, 9 of 70 surveyed residents walk for exercise. At the 5% level, did the rate decrease?
Show solution
, . . . p-value: . We fail to reject: no evidence that the rate fell. - Ex. 103.35Modeling
The average national income of registered nurses is US\bar X = 71,121s = 7,489$. At the 5% level, do California nurses earn more than the national average?
Show solution
See the reference indicated in source for the detailed solution. - Ex. 103.36Modeling
According to the AAA, approximately 54% of fatal accidents are caused by driver error. In a sample of 30 accidents, 14 were caused by driver error. At the 5% level, is there evidence that the proportion in the sample differs from 54%?
Show solution
, p-value . We fail to reject : no evidence that the proportion of accidents from driver error differs from 54%.Show step-by-step (with the why)
- Hypotheses: , (two-tailed).
- With 30 accidents, 14 from driver error: .
- .
- Two-tailed p-value: .
- Since , we fail to reject .
- Ex. 103.37Modeling
The New York Times reported an average commute time of 25.4 minutes in major US cities. Austin believes the local commute is shorter. Surveys 25 workers: min, min. At the 5% level, does Austin have a significantly shorter commute?
Show solution
Two-tailed mean test with unknown $\sigma$. minutes, . With , , : . p-value with : . Do not reject at 5%: no evidence Austin has shorter commute. - Ex. 103.38ModelingAnswer key
A clinical trial tests 20 endpoints with each. (a) What is the probability of at least one false positive, assuming all are true? (b) Apply Bonferroni correction and indicate the new level per test.
Show solution
Without correction: . That is, over 60% chance of at least one false positive without correction. With Bonferroni: per test. Application to clinical trial: only results with p-value below 0.0025 would be declared significant, drastically reducing false positives at the cost of less power for each individual test. - Ex. 103.39Challenge
Exercise 103.20 showed approval of 38 of 100 students versus historical rate of 30%, with . Calculate Cohen's effect size for proportions. Is the result educationally relevant? Compare statistical significance with practical relevance.
Show solution
Cohen's effect size for proportions: . For and : (small effect). With : , p-value . Statistically significant, but effect is small. The pedagogical decision to adopt the methodology should consider cost, scalability, and magnitude of 8 percentage points — not just the p-value. - Ex. 103.40Proof
Derive the analytical expression for the power of a one-tailed z-test () as a function of , , and . Show that power increases with and with (signal-to-noise ratio).
Show solution
Power is . For one-tailed test with $\\sigma$ known and : we reject if . Under : . Power = where . Increases with , and decreases with . - Ex. 103.41ChallengeAnswer key
A genome-wide association study (GWAS) tests 5,000 genetic polymorphisms in 10 students, using for each test without correction. (a) How many false positives are expected? (b) What would the Bonferroni-corrected level be? (c) Discuss why GWAS studies with small samples have low reliability.
Show solution
Type I inflation via multiple testing: with 10 students testing 5,000 genetic polymorphisms each, at 5% level, expect false positives per student, or 2,500 total. Bonferroni correction: per test. Alternative: FDR (Benjamini-Hochberg) is more powerful in GWAS. In studies with small relative to the number of tests, most "significant" results are false positives — illustration of the replicability crisis in genomics. - Ex. 103.42Application
The natural birth ratio is approximately 100 girls per 105 boys (proportion of girls ≈ 48.8%). In China it is reported as 100:114 (≈ 46.7% girls). A researcher studies 150 births and finds 60 girls. At the 5% level, is the proportion of girls significantly different from 48.8%?
Show solution
(natural ratio), . China: . . Two-tailed p-value: . We reject at 5%: the proportion of girls in the studied births is significantly different from the natural ratio.
Sources
- OpenIntro Statistics (4th ed.) — Diez, Çetinkaya-Rundel, Barr · CC-BY-SA. Sections §5.1–5.3 (test structure, p-value, power, sample size).
- Statistics (OpenStax) — Illowsky, Dean · CC-BY. Chapter 9 (null and alternative hypotheses, Type I and II errors, complete examples with z).
- Statistical Thinking for the 21st Century — Russell Poldrack · CC-BY-NC. Chapters 10–11 (replicability crisis, responsible p-value use, FDR, effect size).