1 Background

In agriculture, it is important to have a high yield of crops. For lettuce plants, plants with many leaves are known to be preferred by the consumers.

One way to increase the number of leaves (or better, total leaf weight) is by using a fertilizer. Recently, there has been a tendency to rely more on natural fertilizers, such as compost. Near Ghent, the institute of research for agriculture and fishery is testing new, natural fertilization methods. One of these new fertilizers is called biochar. Biochar is a residual product from pyrolysis, a process in which biomass is burned under specific conditions (such as high pressure) in order to produce energy. Biochar is similar to charcoal, but has some very useful properties, such as retaining water in the soil. It also has a positive influence on the soil microbiome.

2 The lettuce dataset

The researchers hypothesize that biochar, compost and a combination of both biochar and compost can have a different influence on the growth of lettuce plants. To this end, they grew up lettuce plants in a greenhouse. The pots were filled with one of four soil types;

  1. Soil only (control)
  2. Soil supplemented with biochar (refoak)
  3. Soil supplemented with compost (compost)
  4. Soil supplemented with both biochar and compost (cobc)

The dataset freshweight_lettuce.txt contains the freshweight (in grams) for 28 lettuce plants (7 per condition). The researchers want to use an ANOVA test to assess if the treatments have a different effect on the growth of lettuce plants. If so, they will use a post-hoc test (Tuckey test) to discover which specific treatments have an effect.

Load the required libraries

library(tidyverse)
library(multcomp)

3 Data import

lettuce <- read_csv("https://raw.githubusercontent.com/statOmics/PSLSData/main/freshweight_lettuce.txt")
## Rows: 28 Columns: 3
## ── Column specification ──────────────────────────────────────────────
## Delimiter: ","
## chr (1): treatment
## dbl (2): id, freshweight
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Take a glimpse at the data

glimpse(lettuce)
## Rows: 28
## Columns: 3
## $ id          <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1…
## $ treatment   <chr> "control", "control", "control", "control", "con…
## $ freshweight <dbl> 38, 34, 41, 43, 43, 29, 38, 59, 64, 57, 56, 50, …
## treatment to factor
lettuce <- lettuce %>%
  mutate(treatment = as.factor(treatment))

4 Data exploration

## Count the number of observations per treatment
lettuce %>%
  count(treatment)

Make plots to explore the data

# ...

Interpret the boxplots!

5 Questions and assignments

  1. How will you model the data.
  2. Translate the research question into parameters of the model.
  3. Check the assumptions.
  4. If the assumptions are fulfilled you can fit model
  5. Further assess differences between the treatments in a post-hoc analysis if applicable.
  6. Question: can we extrapolate these results to another leaf vegetable, for instance, spinache?
  7. Question: Imaagine that all of the control and refoak plants were grown in 1 greenhouse and the other two conditions were grown in another greenhouse? How would this affect the model assumptions of linear ANOVA?
LS0tCnRpdGxlOiAiRXhlcmNpc2UgNy4xOiBBTk9WQSBvbiB0aGUgbGV0dHVjZSBkYXRhc2V0IgphdXRob3I6ICJMaWV2ZW4gQ2xlbWVudCBhbmQgSmVyb2VuIEdpbGlzIgpkYXRlOiAic3RhdE9taWNzLCBHaGVudCBVbml2ZXJzaXR5IChodHRwczovL3N0YXRvbWljcy5naXRodWIuaW8pIgotLS0KCiMgQmFja2dyb3VuZAoKSW4gYWdyaWN1bHR1cmUsIGl0IGlzIGltcG9ydGFudCB0byBoYXZlIGEgaGlnaCB5aWVsZCBvZiBjcm9wcy4gRm9yIGxldHR1Y2UKcGxhbnRzLCBwbGFudHMgd2l0aCBtYW55IGxlYXZlcyBhcmUga25vd24gdG8gYmUgcHJlZmVycmVkIGJ5IHRoZSBjb25zdW1lcnMuCgpPbmUgd2F5IHRvIGluY3JlYXNlIHRoZSBudW1iZXIgb2YgbGVhdmVzIChvciBiZXR0ZXIsIHRvdGFsCmxlYWYgd2VpZ2h0KSBpcyBieSB1c2luZyBhIGZlcnRpbGl6ZXIuIFJlY2VudGx5LCB0aGVyZSBoYXMgYmVlbgphIHRlbmRlbmN5IHRvIHJlbHkgbW9yZSBvbiBuYXR1cmFsIGZlcnRpbGl6ZXJzLCBzdWNoIGFzIGNvbXBvc3QuCk5lYXIgR2hlbnQsIHRoZSBpbnN0aXR1dGUgb2YgcmVzZWFyY2ggZm9yIGFncmljdWx0dXJlIGFuZCBmaXNoZXJ5IGlzIHRlc3RpbmcKbmV3LCBuYXR1cmFsIGZlcnRpb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