What difference are we estimating?

Day 16 — Independent groups and experimental design

Data Analysis in Life Sciences

About this lecture

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?

  • Name the question, outcome, unit and direction (treated − control) before calculating.
  • Look at the plants first: a difference in means is not a claim about every plant.
  • Check the design: independent groups or paired measurements? Plants or shared trays?
  • A sample difference is one estimate; another experiment would give another number.

Week 4 is about comparisons. Today defines the comparison; Day 17 adds how uncertain it is.

The question and the design

Does the nutrient treatment change seven-day seedling growth?

  • Outcome: growth = final − initial length, in mm, one value per plant.
  • Unit: one plant in its own pot; 12 + 12, randomly allocated.
  • Direction: treated − control. A positive number means treated plants grew more.
  • Random allocation comes from the study description, not from the order of rows in the file.

Twelve control and twelve treated seedlings in separate pots represent independent random allocations.

Choose the outcome that answers the question

  • Left: initial lengths. Controls started slightly larger (mean 23.0 mm vs 21.9 mm).
  • Right: growth over seven days, the outcome for our question.
  • Final length alone would mix starting size with growth.
  • A starting difference is worth noting as a limitation; adjusting for it is beyond this course.

Initial lengths and seven-day growth shown separately for control and treated plants; growth is the outcome for the treatment question.

Start with the observations

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
  • The treated group sits higher, but the groups overlap.
  • The largest control (18.7 mm) grew more than the smallest treated plant (12.2 mm).
  • So “every treated plant grew more” is false, even if the treated mean is higher.

Individual growth values for 12 control and 12 treated plants; the groups overlap although treated plants tend to be higher.

Compute the difference in the stated direction

> 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.
  • Treated − control = 6.22 mm: a number with units and a sign.
  • Say it in words: “treated plants grew on average 6.22 mm more than controls”.

The sign comes from the subtraction, not the name

  • mean(treated) - mean(control) = +6.22 mm.
  • mean(control) - mean(treated) = −6.22 mm.
  • Same plants, same experiment: only the description changes.
  • Calling an object treatment_effect does not fix its sign. State the direction in words next to the number.
  • A report that says one direction and computes the other is wrong.

The same two group means produce +6.22 mm as treated minus control and −6.22 mm as control minus treated.

Independent groups or pairs?

  • Today: different plants in each group (P01 control, P13 treated). The groups are independent.
  • Day 18: the same plant measured before and after a change (L01 before, L01 after). Those readings form a pair and must stay together.
  • Two columns in a table do not make a pair; the same individual does.
  • Within one plant, initial and final are already combined into growth, so each plant gives one value.

On the left, two different plants belong to separate groups; on the right, the same plant measured twice forms a pair.

Plants or shared trays?

Imagine all treated plants shared one tray and all controls another.

  • The plants are still measured, but there is only one treatment assignment per group.
  • A warmer or brighter tray would look exactly like a treatment effect.
  • Counting 24 independent plants would overstate the evidence. No test can repair this; only more independent trays.
  • Our study allocated plants individually, so the plant is the unit.

A hypothetical layout in which tray A receives control and tray B receives treatment, so each tray is one shared treatment unit.

Another sample, another difference

> 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
  • A second class: 9 plants per group. Means 13.66 and 17.87 mm (printed rounded).
  • Treated − control = 4.21 mm, not 6.22 mm.
  • Different plants give a different estimate. That alone does not mean the treatment “failed”.

Transfer study growth values: treated plants have a higher mean, and the observed treated-minus-control difference is 4.21 millimetres.

What we can say today, and what remains open

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?

  • The null hypothesis for Day 17: mean growth would be the same under both conditions if we could grow very many plants.
  • Two-sided: a difference in either direction counts. We decide this now, before seeing a test.
  • A p-value will say how surprising our data are if the means were equal. It is not the probability that the treatment works, and not the size of the effect.

Summary

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.