Work in groups to design a study and prepare a reproducible exploratory report. Investigate two familiar measurements, then ask whether their relationship holds when comparing similar children.
Do children with larger feet tend to obtain higher reading scores?
Imagine that a school asks your group to investigate this question among primary-school children. No measurements are available yet.
Write a short study proposal addressing the following questions.
Plan before prompting. Save your proposal before opening the CSV. If you use AI later, supply your plan and verify its implementation. Keep a record of what you accepted, changed, or rejected and why.
Pause here for a class discussion. The instructor will then release the data and Part 2. Keep the original proposal alongside any revisions.
The supplied CSV is a simulated teaching dataset, not observations of real children. The setting is a fictional primary-school study with one measurement per child. Children in Years 1, 3, and 5 complete the same reading assessment, scored from 0 to 100, and have their shoe size recorded using the same European sizing scale. Higher scores indicate better performance on this assessment.
Use data/shoe_size_reading.csv, in the data
folder next to this Rmd. The CSV is the fixed input for your report; do
not simulate replacement data. The examples use base R. Knitting
requires knitr and rmarkdown.
| Variable | Type | Meaning |
|---|---|---|
child_id |
Identifier | Anonymous label; one row per fictional child |
shoe_size |
Quantitative | European shoe size, recorded in half-size steps |
reading_score |
Quantitative | Common reading assessment, 0–100 points |
school_year |
Categorical | Year 1, Year 3, or Year 5; use as a factor |
handedness |
Categorical | Preferred writing hand: Left or Right |
favourite_colour |
Categorical | Preferred colour: Blue, Green, Red, or Yellow |
birth_season |
Categorical | Season of birth: Winter, Spring, Summer, or Autumn (Northern Hemisphere) |
Shoe size is quantitative despite its discrete steps. Treat school year as three categories, not a numeric predictor with an assumed linear effect. Treat the other background variables as factors too. Their labels provide context, but do not establish whether they explain an association.
data_file <- "data/shoe_size_reading.csv"
if (!file.exists(data_file)) stop("Missing file: ", data_file)
dat <- read.csv(data_file, stringsAsFactors = FALSE)
dat$school_year <- factor(dat$school_year,
levels = c("Year 1", "Year 3", "Year 5"))
other_categories <- c("handedness", "favourite_colour", "birth_season")
dat[other_categories] <- lapply(dat[other_categories], factor)
head(dat)
## child_id shoe_size reading_score school_year handedness favourite_colour
## 1 C001 28 29 Year 1 Right Blue
## 2 C002 31 43 Year 1 Right Red
## 3 C003 34 35 Year 1 Right Red
## 4 C004 31 41 Year 1 Left Green
## 5 C005 30 33 Year 1 Right Blue
## 6 C006 28 40 Year 1 Right Yellow
## birth_season
## 1 Autumn
## 2 Summer
## 3 Winter
## 4 Winter
## 5 Autumn
## 6 Autumn
str(dat)
## 'data.frame': 300 obs. of 7 variables:
## $ child_id : chr "C001" "C002" "C003" "C004" ...
## $ shoe_size : num 28 31 34 31 30 28 28.5 28.5 28.5 28.5 ...
## $ reading_score : int 29 43 35 41 33 40 39 26 35 44 ...
## $ school_year : Factor w/ 3 levels "Year 1","Year 3",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ handedness : Factor w/ 2 levels "Left","Right": 2 2 2 1 2 2 2 2 2 2 ...
## $ favourite_colour: Factor w/ 4 levels "Blue","Green",..: 1 3 3 2 1 4 4 4 3 1 ...
## $ birth_season : Factor w/ 4 levels "Autumn","Spring",..: 1 3 4 4 1 1 3 4 2 3 ...
nrow(dat)
## [1] 300
anyDuplicated(dat$child_id)
## [1] 0
colSums(is.na(dat))
## child_id shoe_size reading_score school_year
## 0 0 0 0
## handedness favourite_colour birth_season
## 0 0 0
table(dat$school_year, useNA = "ifany")
##
## Year 1 Year 3 Year 5
## 100 100 100
summary(dat)
## child_id shoe_size reading_score school_year handedness
## Length :300 Min. :24.00 Min. :17.00 Year 1:100 Left : 30
## N.unique :300 1st Qu.:29.50 1st Qu.:40.00 Year 3:100 Right:270
## N.blank : 0 Median :31.50 Median :53.50 Year 5:100
## Min.nchar: 4 Mean :31.93 Mean :55.41
## Max.nchar: 4 3rd Qu.:34.12 3rd Qu.:71.25
## Max. :41.50 Max. :93.00
## favourite_colour birth_season
## Blue :75 Autumn:75
## Green :75 Spring:75
## Red :75 Summer:75
## Yellow:75 Winter:75
##
##
These commands may help; add the graph and your interpretation.
cor(dat$shoe_size, dat$reading_score)
## [1] 0.720209
pooled_fit <- lm(reading_score ~ shoe_size, data = dat)
coef(pooled_fit)
## (Intercept) shoe_size
## -77.162698 4.151867
Before focusing on school year, compare handedness,
favourite_colour, and birth_season. Do not
assume that every recorded variable is a confounder.
For each variable:
Split the observations into groups and repeat the calculations. Complete this outline in your own report.
by_year <- split(dat, dat$school_year)
lapply(by_year, function(d) {
# Return n, the correlation, and the slope from lm() for this year.
})
Use stratified correlations and separate simple regressions. Multiple regression and continuous adjustment variables are not required. Focus on effect sizes and graphs; formal significance tests are not required.
Submit a short reproducible Rmd report and its knitted HTML containing:
Write in English. Keep numerical precision sensible, label axes and units, and connect each conclusion to a calculated quantity or a visible pattern.
Note on AI assistance
These teaching materials were prepared with assistance from ChatGPT (OpenAI) in drafting explanations, developing examples, and generating R code. The author retains responsibility for the final content.