library(palmerpenguins)
library(tidyverse)
mu0 <- 200
sigma <- 14
adelie <- penguins |>
filter(species == "Adelie") |>
drop_na(flipper_length_mm)
M <- mean(adelie$flipper_length_mm)
n <- nrow(adelie)
SE <- sigma / sqrt(n)
z <- (M - mu0) / SE
z4 Hypothesis Testing: Core Concepts and Z Tests
4.1 Key Concepts
- Z Scores vs. Z Tests
- Probability Distribution
- Alpha
- Type 1 and Type 2 Errors
- Power
4.2 Key Formulas
\[z = \frac{M - \mu_0}{SE}\]
\[SE = \frac{\sigma}{\sqrt{n}}\]
\[\text{Power} = 1 - \beta\]
4.3 Code Examples
p <- 2 * pnorm(-abs(z))
p4.4 Exercises
4.4.1 Conceptual Questions
In hypothesis testing, the null hypothesis (H₀) usually states that:
A. There is no effect or no difference
B. There is a difference in the expected direction
C. The researcher’s prediction is true
D. The effect size is large
The alternative hypothesis (H₁) in a one-tailed test states that:
A. The sample mean differs from the population mean in either direction
B. The sample mean is greater (or less) than the population mean, depending on prediction
C. The population mean equals the sample mean
D. Type I error is impossible
A Type I error occurs when:
A. You fail to reject H₀ when it is false
B. You reject H₀ when it is true
C. You reject H₁ when it is true
D. The p-value equals the effect size
A Type II error occurs when:
A. You reject H₀ when it is true
B. You fail to reject H₀ when it is false
C. α is greater than β
D. You set α = .05 instead of .01
Statistical power is defined as:
A. The probability of rejecting H₀ when H₀ is true
B. The probability of rejecting H₀ when H₀ is false
C. The probability of making a Type I error
D. The probability of failing to reject H₀
Which of the following increases statistical power?
A. Smaller sample size
B. Lower α (e.g., .01 vs. .05)
C. Larger sample size
D. More variability in the data
Which α level would make it harder to reject H₀?
A. α = .05
B. α = .10
C. α = .01
D. α = .50
A researcher predicts that caffeine improves memory recall. Which is the correct null hypothesis?
A. Caffeine improves recall
B. Caffeine impairs recall
C. Caffeine has no effect on recall
D. Caffeine improves recall more than nicotine
If a study has low power, what is most likely to happen?
A. More Type I errors
B. More Type II errors
C. More correct rejections of H₀
D. Effect size increases
The critical z value for a two-tailed test at α = .05 is:
A. ±1.28
B. ±1.645
C. ±1.96
D. ±2.58
4.4.2 Computational Questions
Note: if direction is not specified, use direction implied by hypothesis.
For each problem: write H₀ and H₁, identify the cutoff value(s), compute z (showing the SE calculation and all steps), state your decision, and interpret the result in plain language. Report p < .05 or p > .05 as appropriate.
Problem 1
A cognitive psychologist believes a new mnemonic strategy increases immediate recall above the population average. Use α = .05.
| Parameter | Value |
|---|---|
| Population mean (μ₀) | 15 items |
| Population SD (σ) | 4 |
| Sample size (n) | 36 |
| Sample mean (M) | 16.5 items |
mu0 <- 15 # population mean (items)
sigma <- 4 # population SD
n <- 36 # sample size
M <- 16.5 # sample mean (items)
alpha <- 0.05
Problem 2
An experiment measures reaction time. Use α = .05, two-tailed.
| Parameter | Value |
|---|---|
| Population mean (μ₀) | 350 ms |
| Population SD (σ) | 60 ms |
| Sample size (n) | 49 |
| Sample mean (M) | 340 ms |
mu0 <- 350 # population mean (ms)
sigma <- 60 # population SD
n <- 49 # sample size
M <- 340 # sample mean (ms)
alpha <- 0.05
Problem 3
A hospital reviews case files and suspects that users of a particular drug die earlier than the national average. Use α = .01.
| Parameter | Value |
|---|---|
| National mean lifespan (μ₀) | 78 years |
| Population SD (σ) | 6 years |
| Sample size (n) | 64 |
| Sample mean (M) | 75.8 years |
mu0 <- 78 # national mean lifespan (years)
sigma <- 6 # population SD
n <- 64 # sample size
M <- 75.8 # sample mean (years)
alpha <- 0.01
Problem 4
A counseling center uses a standardized depression score where lower scores indicate fewer symptoms. After a new group-therapy program, they assess a sample of clients. Use α = .10, two-tailed.
| Parameter | Value |
|---|---|
| Population mean (μ₀) | 22 |
| Population SD (σ) | 5 |
| Sample size (n) | 25 |
| Sample mean (M) | 20.2 |
mu0 <- 22 # population mean (lower = fewer symptoms)
sigma <- 5 # population SD
n <- 25 # sample size
M <- 20.2 # sample mean
alpha <- 0.10
Problem 5
A professor worries that a new, harder exam lowered student performance. Use α = .05.
| Parameter | Value |
|---|---|
| Historical population mean (μ₀) | 75 |
| Population SD (σ) | 10 |
| Sample size (n) | 100 |
| Sample mean (M) | 72 |
mu0 <- 75 # historical population mean
sigma <- 10 # population SD
n <- 100 # sample size
M <- 72 # sample mean
alpha <- 0.05