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(car)

3 Data import

lettuce <- read_csv("https://raw.githubusercontent.com/statOmics/PSLS21/data/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, 15, 16, 17,…
## $ treatment   <chr> "control", "control", "control", "control", "control", "co…
## $ freshweight <dbl> 38, 34, 41, 43, 43, 29, 38, 59, 64, 57, 56, 50, 64, 62, 38…
## 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?
LS0tCnRpdGxlOiAiRXhlcmNpc2UgNy4xOiBBTk9WQSBvbiB0aGUgbGV0dHVjZSBkYXRhc2V0IiAgIAphdXRob3I6ICJMaWV2ZW4gQ2xlbWVudCBhbmQgSmVyb2VuIEdpbGlzIgpkYXRlOiAic3RhdE9taWNzLCBHaGVudCBVbml2ZXJzaXR5IChodHRwczovL3N0YXRvbWljcy5naXRodWIuaW8pIiAgCm91dHB1dDoKICAgIGh0bWxfZG9jdW1lbnQ6CiAgICAgIGNvZGVfZG93bmxvYWQ6IHRydWUgICAgCiAgICAgIHRoZW1lOiBjb3NtbwogICAgICB0b2M6IHRydWUKICAgICAgdG9jX2Zsb2F0OiB0cnVlCiAgICAgIGhpZ2hsaWdodDogdGFuZ28KICAgICAgbnVtYmVyX3NlY3Rpb25zOiB0cnVlCi0tLQoKIyBCYWNrZ3JvdW5kCgpJbiBhZ3JpY3VsdHVyZSwgaXQgaXMgaW1wb3J0YW50IHRvIGhhdmUgYSBoaWdoIHlpZWxkIG9mIGNyb3BzLiBGb3IgbGV0dHVjZSAKcGxhbnRzLCBwbGFudHMgd2l0aCBtYW55IGxlYXZlcyBhcmUga25vd24gdG8gYmUgcHJlZmVycmVkIGJ5IHRoZSBjb25zdW1lcnMuCgpPbmUgd2F5IHRvIGluY3JlYXNlIHRoZSBudW1iZXIgb2YgbGVhdmVzIChvciBiZXR0ZXIsIHRvdGFsCmxlYWYgd2VpZ2h0KSBpcyBieSB1c2luZyBhIGZlcnRpbGl6ZXIuIFJlY2VudGx5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