Homework 1 Answer

ESRM 64103: Experimental Design in Education

Author
Affiliation

Jihong Zhang*, Ph.D

Educational Statistics and Research Methods (ESRM) Program*

University of Arkansas

Published

September 15, 2026

Example 2: Sleep Duration and Exam Scores

The example compares mean exam scores across three independent sleep-duration groups using a one-way analysis of variance (ANOVA).

Starting Data and Descriptive Statistics

The following code reproduces the starting dataset provided with Homework 1. The original column names are retained so that this answer matches the student starting code.

# Set seed for reproducibility
set.seed(42)

# Generate data for three sleep groups
less_than_6_hours <- rnorm(30, mean = 65, sd = 10)
six_to_eight_hours <- rnorm(50, mean = 75, sd = 8)
more_than_8_hours <- rnorm(20, mean = 78, sd = 7)

# Combine data into a single data frame
sleep_data <- data.frame(
  Sleep_Group = factor(c(
    rep("<6 hours", 30),
    rep("6-8 hours", 50),
    rep(">8 hours", 20)
  )),
  Exam_Score = c(
    less_than_6_hours,
    six_to_eight_hours,
    more_than_8_hours
  )
)

# View the first few rows of the dataset
head(sleep_data)
  Sleep_Group Exam_Score
1    <6 hours   78.70958
2    <6 hours   59.35302
3    <6 hours   68.63128
4    <6 hours   71.32863
5    <6 hours   69.04268
6    <6 hours   63.93875
library(dplyr)

group_summary <- sleep_data |>
  group_by(Sleep_Group) |>
  summarise(
    Sample_Size = n(),
    Mean = mean(Exam_Score),
    Standard_Deviation = sd(Exam_Score),
    .groups = "drop"
  )

group_summary
# A tibble: 3 × 4
  Sleep_Group Sample_Size  Mean Standard_Deviation
  <fct>             <int> <dbl>              <dbl>
1 <6 hours             30  65.7              12.6 
2 >8 hours             20  78.6               6.43
3 6-8 hours            50  74.9               7.71

One-Way ANOVA

anova_model <- aov(Exam_Score ~ Sleep_Group, data = sleep_data)
anova_results <- summary(anova_model)
anova_results
            Df Sum Sq Mean Sq F value   Pr(>F)    
Sleep_Group  2   2411  1205.4   14.15 4.06e-06 ***
Residuals   97   8264    85.2                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova_table <- anova_results[[1]]
f_statistic <- anova_table[["F value"]][1]
p_value <- anova_table[["Pr(>F)"]][1]
numerator_df <- anova_table[["Df"]][1]
denominator_df <- anova_table[["Df"]][2]

Answers

Q1. What is the null hypothesis of Example 2?

NoteAnswer

The null hypothesis is that the population mean exam scores are equal across all three sleep-duration groups:

H_0:\mu_{<6}=\mu_{6\text{-}8}=\mu_{>8}.

The alternative hypothesis is that at least one population mean differs from another.

Q2. What is the value of the F-statistic for the student groups?

NoteAnswer

The ANOVA result is F(2, 97) = 14.15, with p = 4.06e-06.

Q3. Given alpha as 0.05, is the F-statistic significant?

NoteAnswer

Yes. The p-value is smaller than \alpha=.05, so the omnibus F-test is statistically significant.

Q4. Will you reject or retain the null hypothesis?

NoteAnswer

Reject the null hypothesis because the p-value is less than alpha. The result provides evidence that the population mean exam scores are not equal across all three sleep-duration groups. The omnibus ANOVA alone does not identify which specific group means differ; that question requires justified follow-up comparisons.

Back to top