Day 23 — an integrated study briefing
In a later lab course, or in your thesis project, you will be handed a table from an experiment and asked: “what did the treatment do?” You will be expected to answer with a short report: the question, a plot, the numbers, one limitation, and code that someone else can run again. Today you do that whole job once, on one small study.
Today you will:
No new methods today: everything comes from weeks 2–4. Day 24 tests whether someone else can reproduce your report.
Duckweed (default)
duckweed-report.RmdOrganic alternative
organic-study.RmdSave in reports/study-decisions.txt:
> duckweed <- read_csv("data/duckweed.csv", show_col_types = FALSE)
> glimpse(duckweed)
Rows: 20
Columns: 3
$ flask_id <chr> "F01", "F02", "F03", "F04", "F05", "F06", …
$ treatment <chr> "control", "control", "control", "control",…
$ biomass_mg <dbl> 36.4, 38.0, 34.9, 36.1, 25.8, 35.6, 29.5, 1…
> count(duckweed, treatment)
# A tibble: 2 × 2
treatment n
<chr> <int>
1 control 10
2 nutrient 10
> duckweed$flask_id[is.na(duckweed$biomass_mg)]
[1] "F17"
glimpse(): 20 flasks, 3 columns, biomass is a number (dbl).count(): 10 flasks per group, as designed.is.na() finds the flask without a biomass: F17, spilled before weighing. Missing is not zero.> available <- duckweed |>
+ filter(!is.na(biomass_mg))
> count(available, treatment)
# A tibble: 2 × 2
treatment n
<chr> <int>
1 control 10
2 nutrient 9
ggplot(available, aes(x = treatment, y = biomass_mg)) +
geom_point(position = position_jitter(
width = 0.08, height = 0, seed = 23)) +
labs(x = "Treatment",
y = "Dry biomass after seven days (mg)") +
theme_minimal()available drops F17 for the plot; duckweed keeps its row.
> nutrient <- available |> filter(treatment == "nutrient")
> control <- available |> filter(treatment == "control")
> comparison <- t.test(nutrient$biomass_mg,
+ control$biomass_mg)
> comparison
Welch Two Sample t-test
data: nutrient$biomass_mg and control$biomass_mg
t = 3.0522, df = 16.936, p-value = 0.007229
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
2.268932 12.437735
sample estimates:
mean of x mean of y
39.63333 32.28000
> organic <- read_csv("data/organic-recovery.csv",
+ show_col_types = FALSE) |>
+ mutate(yield_percent = 100 * isolated_mass_g /
+ theoretical_mass_g)
> organic |>
+ group_by(protocol) |>
+ summarise(n = n(), mean_yield = mean(yield_percent),
+ sd_yield = sd(yield_percent))
# A tibble: 2 × 4
protocol n mean_yield sd_yield
<chr> <int> <dbl> <dbl>
1 modified 6 77 3.74
2 standard 6 68.7 4.32
Include: direction and size with units, available n, the spread or overlap, the uncertainty if you estimated it, and one limitation.
“Nutrient flasks had on average 7.35 mg more dry biomass than controls (95% CI 2.27 to 12.44 mg; Welch, p ≈ 0.007; 9 nutrient and 10 control flasks). F17 was spilled and has no measurement.”
| Faulty draft | Repair |
|---|---|
| “There were 20 biomass results.” | 20 flasks, 19 measurements; F17 missing. |
| “The nutrient plants all grew more.” | The groups overlap; the mean is higher. |
| “The SD is the error in the treatment effect.” | SD is spread of flasks; the CI is uncertainty in the difference. |
| “p is the probability that nutrients work.” | p assumes no difference and asks how surprising the data are. |
data/algae.csv: 24 cultures, reference or supplement; A19 was spilled.Keep data/ unchanged and outputs in output/. If something fails, write down where.
Next (Day 24, reproduce and share): can someone else run your report in a fresh copy of the project and get the same result?
Now: open the Day 23 exercises. Leave with duckweed-report.Rmd (or organic-study.Rmd) and its HTML, reports/study-decisions.txt, and the algae script and memo.