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
In an honours thesis from (1992), Mullens was investigating the ways that cane toads ( Bufo marinus ) respond to conditions of hypoxia. Toads show two different kinds of breathing patterns, lung or buccal, requiring them to be treated separately in the experiment. Her aim was to expose toads to a range of O2 concentrations, and record their breathing patterns, including parameters such as the expired volume for individual breaths. It was desirable to have around 8 replicates to compare the responses of the two breathing types, and the complication is that animals are expensive, and different individuals are likely to have different O2 profiles (leading to possibly reduced power). There are two main design options for this experiment;
Mullens decided to use the second option so as to reduce the number of animals required (on financial and ethical grounds). By selecting this option, she did not have a set of independent measurements for each oxygen concentration, by repeated measurements on each animal across the 8 oxygen concentrations.
Format of mullens.csv data file
BREATH | TOAD | O2LEVEL | FREQBUC | SFREQBUC |
---|---|---|---|---|
lung | a | 0 | 10.6 | 3.256 |
lung | a | 5 | 18.8 | 4.336 |
lung | a | 10 | 17.4 | 4.171 |
lung | a | 15 | 16.6 | 4.074 |
... | ... | ... | ... | ... |
BREATH | Categorical listing of the breathing type treatment (buccal = buccal breathing toads, lung = lung breathing toads). This is the between subjects (plots) effect and applies to the whole toads (since a single toad can only be one breathing type - either lung or buccal). Equivalent to Factor A (between plots effect) in a split-plot design |
TOAD | These are the subjects (equivalent to the plots in a split-plot design: Factor B). The letters in this variable represent the labels given to each individual toad. |
O2LEVEL | 0 through to 50 represent the the different oxygen concentrations (0% to 50%). The different oxygen concentrations are equivalent to the within plot effects in a split-plot (Factor C). |
FREQBUC | The frequency of buccal breathing - the response variable |
SFREQBUC | Square root transformed frequency of buccal breathing - the response variable |
mullens = read_csv('data/mullens.csv', trim_ws=TRUE)
## Parsed with column specification:
## cols(
## BREATH = col_character(),
## TOAD = col_character(),
## O2LEVEL = col_integer(),
## FREQBUC = col_double(),
## SFREQBUC = col_double()
## )
glimpse(mullens)
## Observations: 168
## Variables: 5
## $ BREATH <chr> "lung", "lung", "lung", "lung", "lung", "lung", "lung...
## $ TOAD <chr> "a", "a", "a", "a", "a", "a", "a", "a", "b", "b", "b"...
## $ O2LEVEL <int> 0, 5, 10, 15, 20, 30, 40, 50, 0, 5, 10, 15, 20, 30, 4...
## $ FREQBUC <dbl> 10.6, 18.8, 17.4, 16.6, 9.4, 11.4, 2.8, 4.4, 21.6, 17...
## $ SFREQBUC <dbl> 3.255764, 4.335897, 4.171331, 4.074310, 3.065942, 3.3...
Model formula: \[ y_i \sim{} \mathcal{Pois}(\lambda_i)\\ ln(\lambda_i) =\boldsymbol{\beta} \bf{X_i} + \boldsymbol{\gamma} \bf{Z_i} \]
where \(\boldsymbol{\beta}\) and \(\boldsymbol{\gamma}\) are vectors of the fixed and random effects parameters respectively and \(\bf{X}\) is the model matrix representing the overall intercept and effects of copper, distance and their interaction on the number of number of worms. Area of the place segment was also incorporated as an offset. \(\bf{Z}\) represents a cell means model matrix for the random intercepts associated with individual plates.