cetaceans: Data from a repeated measures study on age by tooth staining...

cetaceansR Documentation

Data from a repeated measures study on age by tooth staining methods of stranded Cetaceans

Description

Results of a study comparing three staining methods to determine age of dolphins from six species of cetaceans from two different locations (Spain and Scotland). It is unclear how the numeric values of sex are coded so they are left as integers. This dataset has been cleaned to remove the dolphin with undetermined sex (DolphinID = 10).

Usage

cetaceans

Format

a data.frame with 177 observations on 11 variables from 59 dolphins:

DolphinID

Dolphin ID from 1 to 61 (excluding 10 and 16)

Species

Species of cetacean (6 species)

Age

Age determined by staining method from a tooth, numeric

Sex

Sex of dolphin, integer

Stain

Treatment, staining method (Mayer, Elrich, Toluidine), categorical

Location

Location of stranding (Scotland, Spain), categorical

fSpecies

Factor version of Species variable

fDolphinID

Factor version of DolphinID

fStain

Factor version of Stain

fLocation

Factor version of Location

fSex

Factor version of Sex

Details

Additional variables include sex of the animal, location of the stranding, and stain (Mayer Haematoxylin, Ehlrich Haematoxylin, and Toluidine Blue).

Source

https://www.highstat.com/Books/Book2/ZuurDataMixedModelling.zip

References

Zuur AF, Ieno EN, Walker N, Saveliev AA, and Smith GM. 2009. Mixed effects models and extensions in ecology with R. Statistics for Biology and Health. Springer New York, p. 460. DOI: 10.1007/978-0-387-87458-6

Examples

library(dplyr)
data("cetaceans")


# Exploratory Data Plots
library(ggplot2)
library(viridis)
p1 <- cetaceans %>%
  ggplot(aes(x = DolphinID, y = Age, group=fDolphinID)) +
  geom_boxplot(aes(color=fSpecies)) +
  scale_color_viridis_d(end = 0.8) +
  theme_bw() +
  theme(legend.position="none")
p2 <- cetaceans %>%
  ggplot(aes(x = fSpecies, y = Age, group=fSpecies)) +
  geom_boxplot(aes(color = fSpecies)) +
  scale_color_viridis_d(end = 0.8) +
  theme_bw() +
  theme(axis.text.x = element_text(angle=90),
        legend.position="none")
p3 <- cetaceans %>% ggplot(aes(x = fSpecies, y = Age)) +
  geom_boxplot(aes(color = fSpecies)) +
  scale_color_viridis_d(end = 0.8) +
  facet_wrap(~fLocation)+
  theme_bw() +
  theme(axis.text.x = element_text(angle=90))

library(patchwork)
(p1) / (p2) / (p3)

# Simple model for testing
library(nlme)
lme_simple <- lme(Age ~ fSex*fStain*fLocation,
                  random = ~ 1|fSpecies/fDolphinID,
                  data = cetaceans)
model_diagram(lme_simple)


# Intended full model
library(lme4)
library(lmerTest)
lmer1 <- lmer(Age ~ fSex*fStain*fLocation + (1|fSpecies/fDolphinID), data = cetaceans)
summary(lmer1)
model_diagram(lmer1)


modeldiagramR documentation built on April 15, 2026, 5:07 p.m.