library(palmerpenguins)
library(tidyverse)
two_species <- penguins |>
filter(species %in% c("Adelie", "Chinstrap")) |>
drop_na(flipper_length_mm)
t.test(flipper_length_mm ~ species, data = two_species, var.equal = TRUE)6 T-Tests: Part #2
6.1 Key Concepts
- Independent Samples (Between-Subjects) Design
- Pooled Variance
- Degrees of Freedom
- Standard Error of the Difference
6.2 Key Formulas
\[t = \frac{M_1 - M_2}{s_p\sqrt{\dfrac{1}{n_1} + \dfrac{1}{n_2}}}\]
\[s_p^2 = \frac{SS_1 + SS_2}{df_1 + df_2}\]
\[df = N_{total} - 2\]
6.3 Code Examples
penguins |>
filter(species %in% c("Adelie", "Chinstrap")) |>
drop_na(flipper_length_mm) |>
group_by(species) |>
summarise(M = mean(flipper_length_mm), SD = sd(flipper_length_mm), n = n())6.4 Exercises
6.4.1 Conceptual Questions
In hypothesis testing, the p-value represents:
A. The probability that the null hypothesis is true
B. The probability of obtaining a result at least as extreme as the observed data, given H₀ is true
C. The proportion of participants showing the effect
D. Effect size
As degrees of freedom increase, the shape of the t-distribution:
A. Becomes wider and flatter
B. Becomes identical to the chi-square distribution
C. Becomes narrower and more similar to the normal distribution
D. Remains unchanged
A one-tailed test is appropriate when:
A. The researcher predicts a specific direction of the effect
B. No direction is predicted
C. The sample variance is unknown
D. The study is underpowered
If sample size increases, the standard error will:
A. Increase
B. Decrease
C. Stay the same
D. Equal the standard deviation
If α = .01 instead of .05, what happens?
A. Type I error risk increases
B. Type I error risk decreases
C. Power increases
D. Power stays the same
Statistical significance means:
A. The result is guaranteed to be practically important
B. The observed effect, or a more extreme effect, is likely assuming H₀
C. The observed effect, or a more extreme effect, is unlikely assuming H₀
D. The sample size is large
If an independent-means t-test yields t(18) = 2.45, p = .025 (two-tailed; α = .05), the correct decision is:
A. Fail to reject H₀
B. Reject H₀
C. Accept H₁ at α = .05
D. Unknown
Which of the following assumptions does NOT apply to any kind of t-test?
A. Observations are independent within each group
B. Homogeneity of variance across groups
C. Equal sample sizes
D. All of the above
A one-sample t-test reports df = 374. What was N?
A. 375
B. 374
C. 376
D. None of the above
6.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 all descriptive statistics and t (showing all steps), state your decision, and interpret the result in plain language.
Problem 1 (25 points)
A researcher wants to know whether listening to classical music improves concentration. Eight participants complete a concentration task after sitting in silence for 15 minutes; a separate group of eight complete the same task after listening to 15 minutes of classical music. Higher scores indicate better concentration. Conduct the appropriate test at α = .05.
| Participant | Silence | Participant | Music |
|---|---|---|---|
| 1 | 72 | 1 | 80 |
| 2 | 68 | 2 | 78 |
| 3 | 74 | 3 | 82 |
| 4 | 70 | 4 | 75 |
| 5 | 69 | 5 | 79 |
| 6 | 71 | 6 | 77 |
| 7 | 73 | 7 | 83 |
| 8 | 67 | 8 | 81 |
silence <- c(72, 68, 74, 70, 69, 71, 73, 67)
music <- c(80, 78, 82, 75, 79, 77, 83, 81)
alpha <- 0.05Compute the following for each group:
| Statistic | Silence | Music |
|---|---|---|
| Sum = | ||
| N = | ||
| Mean = | ||
| SS = | ||
| df = |
Compute pooled variance, SE, and t:
Write H₀/H₁ and determine the cutoff value:
State your decision and interpret:
Problem 2 (5 points)
A researcher compares reaction times between caffeine and placebo groups, expecting a reduction in reaction times following caffeine consumption. Name and conduct the appropriate t-test at α = .01. State hypotheses, show all steps, and interpret.
| Parameter | Caffeine | Placebo |
|---|---|---|
| N | 12 | 12 |
| Mean (M) | 248 ms | 262 ms |
| SD | 15 | 18 |
M_caffeine <- 248; SD_caffeine <- 15; n_caffeine <- 12
M_placebo <- 262; SD_placebo <- 18; n_placebo <- 12
alpha <- 0.01Compute SS, pooled variance, SE, df, and t:
Write H₀/H₁, determine cutoff, state decision, and interpret: