Comparison of female lizard lengths for two species
This report provides an exploratory comparison between the total lengths of two species of female lizards, the Desert Grassland lizard (Cnemidophorus uniparens) and the Colorado Checkered lizard (Cnemidophorus tessalatus), using the Jornada Basin LTER lizards data set (Lightfoot 2017). Total female lizard length data will be visually explored as well as statistically analyzed through a two-sample t-test to determine whether there is a significant difference in mean total length for female lizards of each species.
# Read in the data and clean column names
lizard <- read.csv(here("data", "lizards.csv")) %>%
clean_names()
# Create a new subset of data
lizard_length <- lizard %>%
select(spp, sex, total_length) %>% # selects three variables
filter(sex == "F", # filters for female lizards
spp %in% c("CNUN", "CNTE")) %>% # filters to only include observations for CNUN and CNTE species
mutate(spp = case_when(
spp == "CNUN" ~ "Desert Grassland",
spp == "CNTE" ~ "Colorado Checkered"))
# Create a finalized visualization comparing total lengths of female lizards for the two species.
ggplot(data = lizard_length,
aes(x = spp, y = total_length)) +
geom_beeswarm(aes(color = spp,
alpha = 0.5)) +
scale_color_manual(values = c("darkorange","springgreen4")) +
geom_boxplot(fill = NA,
width = 0.1) +
stat_summary(fun=mean,
geom="point",
shape=20,
size=3,
color="black",
fill="black") +
labs(x = "Species",
y = "Total Length (mm)",
title = "Total Lengths of Female Lizards") +
theme_light() +
theme(legend.position = "none")
Figure 1. Comparison between the total lengths (mm) for female lizards of the Colorado Checkered (Cnemidophorus tessalatus) and Desert Grassland (Cnemidophorus uniparens) species. Box endpoints indicate the 25th and 75th percentile values; the black line and black point within the box indicate the median and mean value for each species, respectively. (Data: Lightfoot 2017).
Table 1. Descriptive statistics (mean, standard deviation, and sample size) for total length of female lizards for the two species: Colorado Checkered (Cnemidophorus tessalatus) and Desert Grassland (Cnemidophorus uniparens). (Data: Lightfoot 2017).
# Descriptive statistics data subset
lizard_length_stats <- lizard_length %>%
select(spp, total_length) %>%
group_by(spp) %>%
summarize(mean_length = round(mean(total_length, na.rm = TRUE),2),
sd_length = round(sd(total_length, na.rm = TRUE),2),
sample_size = n())
# Finalized summary table
lizard_length_stats %>%
kable(col.names = c("Species", "Mean Length (mm)", "Standard deviation (mm)", "Sample size")) %>%
kable_styling()
Species | Mean Length (mm) | Standard deviation (mm) | Sample size |
---|---|---|---|
Colorado Checkered | 244.89 | 47.32 | 28 |
Desert Grassland | 147.60 | 34.55 | 47 |
On average, female Colorado Checkered lizards are longer than female Desert Grassland lizards (244.89 \(\pm\) 47.32 and 147.6 \(\pm\) 34.55 mm, respectively; mean \(\pm\) 1 standard deviation) (Figure 1, Table 1). While the absolute difference in means is 97.29 mm (a 49.58% difference), the difference in means is significant (Welch’s two-sample t-test: t(46.43) = 9.28, p < 0.001), and the effect size is large (Cohen’s d = 2.42).