Preparations

Load the necessary libraries

library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag():    dplyr, stats

Scenario

Here is an example from Fowler, Cohen, and Jarvis (1998). An agriculturalist was interested in the effects of fertilizer load on the yield of grass. Grass seed was sown uniformly over an area and different quantities of commercial fertilizer were applied to each of ten 1 m2 randomly located plots. Two months later the grass from each plot was harvested, dried and weighed. The data are in the file fertilizer.csv in the data folder.

FERTILIZER YIELD
25 84
50 80
75 90
100 154
125 148
... ...
FERTILIZER: Mass of fertilizer (g.m-2) - Predictor variable
YIELD: Yield of grass (g.m-2) - Response variable

The aim of the analysis is to investigate the relationship between fertilizer concentration and grass yield.

Read in the data

fert = read_csv('data/fertilizer.csv', trim_ws=TRUE)
## Parsed with column specification:
## cols(
##   FERTILIZER = col_integer(),
##   YIELD = col_integer()
## )
glimpse(fert)
## Observations: 10
## Variables: 2
## $ FERTILIZER <int> 25, 50, 75, 100, 125, 150, 175, 200, 225, 250
## $ YIELD      <int> 84, 80, 90, 154, 148, 169, 206, 244, 212, 248

Exploratory data analysis

Model formula: \[ y_i \sim{} \mathcal{N}(\mu_i, \sigma^2)\\ \mu_i = \beta_0 + \beta_1 x_i \]

Fit the model

Model validation

Model investigation / hypothesis testing

Predictions

Summary figures

References

Fowler, J., L. Cohen, and P. Jarvis. 1998. Practical Statistics for Field Biology. England: John Wiley & Sons.