Day 16 — Independent groups and experimental design
Your descriptive report says treated seedlings grew more on average. Your supervisor asks: “More than what, by how many millimetres, measured how, and could the set-up itself have produced that?” Before any statistical test, a comparison has to be defined: the outcome, the units, the direction, and which plants count as independent. What exactly are we comparing, and what can the design support?
Week 4 is about comparisons. Today defines the comparison; Day 17 adds how uncertain it is.
Does the nutrient treatment change seven-day seedling growth?
seedlings <- read_csv("data/seedlings.csv",
show_col_types = FALSE) |>
mutate(growth_mm = final_mm - initial_mm)
growth_plot <- ggplot(seedlings,
aes(x = treatment, y = growth_mm)) +
geom_point(position = position_jitter(
width = 0.08, height = 0, seed = 16)) +
labs(x = "Treatment group",
y = "Growth over the study period (mm)") +
theme_minimal()
growth_plot
> treated <- seedlings |>
+ filter(treatment == "treated") |>
+ pull(growth_mm)
> treated
[1] 30.8 21.4 29.7 20.7 12.2 21.0 18.2 20.1 20.2 19.5 21.8 22.3
> control <- seedlings |>
+ filter(treatment == "control") |>
+ pull(growth_mm)
> control
[1] 18.6 8.0 14.9 18.0 13.4 16.0 17.1 11.3 15.3 18.7 14.5 17.5
> mean(treated)
[1] 21.49167
> mean(control)
[1] 15.275
> observed_difference <- mean(treated) - mean(control)
> observed_difference
[1] 6.216667
pull() takes one column out of the table as a plain vector: the 12 growth values of one group.mean(treated) - mean(control) = +6.22 mm.mean(control) - mean(treated) = −6.22 mm.treatment_effect does not fix its sign. State the direction in words next to the number.Imagine all treated plants shared one tray and all controls another.
> transfer <- read_csv("data/seedlings-transfer.csv",
+ show_col_types = FALSE) |>
+ mutate(growth_mm = final_mm - initial_mm)
> transfer |>
+ group_by(treatment) |>
+ summarise(n = n(), mean_mm = mean(growth_mm),
+ sd_mm = sd(growth_mm), .groups = "drop")
# A tibble: 2 × 4
treatment n mean_mm sd_mm
<chr> <int> <dbl> <dbl>
1 control 9 13.7 2.53
2 treated 9 17.9 1.94
Results paragraph: “Treated seedlings grew a mean of 21.49 mm (SD 4.87) and controls 15.28 mm (SD 3.19), 12 plants each: a difference of 6.22 mm (treated − control). Growth overlapped between the groups.”
Still open: would another set of plants give a similar difference, or could chance alone produce 6 mm?
| Concept | Key fact |
|---|---|
| Plan first | Question, outcome (growth, mm), unit (potted plant), direction (treated − control), before calculating |
| Outcome | Growth answers the question; initial length is a possible limitation (23.0 vs 21.9 mm) |
| Observations | Plot the plants; groups overlap, so a mean difference is not “every plant” |
| Difference | 21.49 − 15.28 = 6.22 mm; the sign comes from the subtraction order |
| Independent vs paired | Different plants are independent; the same plant twice is a pair (Day 18) |
| Design | Shared trays → the tray is the unit; a test cannot repair the design |
| One estimate | Another study gave 4.21 mm; samples vary |
| Open question | Is 6.22 mm larger than chance variation could produce? (Day 17) |
Next (Day 17, Welch test): how uncertain is the 6.22 mm difference? We add a confidence interval and a p-value, using the same treated and control vectors and the same direction.
Now: open the Day 16 exercises. Leave with comparison.Rmd, its rendered HTML, and output/day16-growth.png.