M_CRF <- read.csv("M_CRF_combined.csv")
M_CRF <- standardise_levels(M_CRF)
glmer((target offspring, competitor offspring) ~ Selection x Female x Background x Replicate + (1|Contest), family = binomial).
Overall, ML males displayed greater mating success, with a model-estimated probability of siring offspring of 32.5%, relative to 24.3% for MC males. However, this effect also depended on interactions with female type and male genetic background, as detailed below.
m_crf <- glmer(
cbind(Red, U) ~
Selection*Female*Background*Replicate +
(1|Contest),
data = na.omit(M_CRF),
family = "binomial"
)
rep_anova(
car::Anova(m_crf),
title = "Table S1.1: Competitive reproductive fitness"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
| Table S1.1: Competitive reproductive fitness | |||
| Term | Chisq | Df | Pr(>Chisq) |
|---|---|---|---|
| Selection | 56.448 | 1 | < 0.001 |
| Female | 0.436 | 1 | 0.509 |
| Background | 241.299 | 1 | < 0.001 |
| Replicate | 1.785 | 2 | 0.410 |
| Selection:Female | 3.774 | 1 | 0.052 |
| Selection:Background | 17.446 | 1 | < 0.001 |
| Female:Background | 49.498 | 1 | < 0.001 |
| Selection:Replicate | 1.170 | 2 | 0.557 |
| Female:Replicate | 4.302 | 2 | 0.116 |
| Background:Replicate | 0.477 | 2 | 0.788 |
| Selection:Female:Background | 0.171 | 1 | 0.679 |
| Selection:Female:Replicate | 0.020 | 2 | 0.990 |
| Selection:Background:Replicate | 3.459 | 2 | 0.177 |
| Female:Background:Replicate | 0.844 | 2 | 0.656 |
| Selection:Female:Background:Replicate | 5.755 | 2 | 0.056 |
Multiple-testing correction. Adjusted alpha for 4 contrast tests: ~0.013.
alpha_adj <- 1 - (0.95)^(1/4)
em <- emmeans(m_crf,
~ Selection | Female * Background)
contrasts <- pairs(em) %>% as.data.frame()
rep_contrasts(contrasts, alpha_adj,
"Table S1.2: Male CRF Contrasts") %>%
tab_options(table.font.size = px(13), data_row.padding = px(4))
| Table S1.2: Male CRF Contrasts | |||||||
| contrast | Female | Background | estimate | SE | df | z.ratio | p.value |
|---|---|---|---|---|---|---|---|
| ML - MC | CG | CG | 0.852 | 0.133 | Inf | 6.414 | < 0.001 |
| ML - MC | C | CG | 0.661 | 0.137 | Inf | 4.831 | < 0.001 |
| ML - MC | CG | C | 0.370 | 0.114 | Inf | 3.254 | 0.001 |
| ML - MC | C | C | 0.059 | 0.139 | Inf | 0.422 | 0.673 |
plotDat <- make_emm(m_crf, response = T)
contrasts_df <- sig_ext(contrasts)
plot_glm_means_ci(plotDat, contrasts_df, title="Competitive reproductive fitness") +
labs(
x = "Genetic background",
y = "Proportion sired",
colour = "Selection"
)
sim_res <- simulateResiduals(m_crf)
plot(sim_res)
par(mfrow = c(2,2))
testDispersion(sim_res)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 0.97573, p-value = 0.72
## alternative hypothesis: two.sided
testOutliers(sim_res)
##
## DHARMa outlier test based on exact binomial test with approximate
## expectations
##
## data: sim_res
## outliers at both margin(s) = 5, observations = 666, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
## 0.00244203 0.01743245
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 )
## 0.007507508
testUniformity(sim_res)
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: simulationOutput$scaledResiduals
## D = 0.04634, p-value = 0.1145
## alternative hypothesis: two-sided
par(mfrow = c(1,1))
M_MC <- read.csv("M_MC_combined.csv")
M_MC <- standardise_levels(M_MC)
M_MC$Success <- as.integer(M_MC$Mated.male == "wt")
glm(Success ~ Selection x Female x Background x Replicate, family = binomial).
Overall, ML males were more successful in mate-choice trials, winning 305 of 535 trials, compared with 246 of 528 trials for MC males.
m_mc <- glm(
Success ~
Selection*Female*Background*Replicate,
data = M_MC,
family = "binomial"
)
rep_anova(
car::Anova(m_mc),
title = "Table S2.1: Mating success"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
| Table S2.1: Mating success | |||
| Term | LR Chisq | Df | Pr(>Chisq) |
|---|---|---|---|
| Selection | 12.114 | 1 | 0.001 |
| Female | 6.145 | 1 | 0.013 |
| Background | 1.928 | 1 | 0.165 |
| Replicate | 14.171 | 2 | 0.001 |
| Selection:Female | 0.212 | 1 | 0.645 |
| Selection:Background | 0.035 | 1 | 0.852 |
| Female:Background | 0.100 | 1 | 0.752 |
| Selection:Replicate | 0.591 | 2 | 0.744 |
| Female:Replicate | 0.005 | 2 | 0.997 |
| Background:Replicate | 1.326 | 2 | 0.515 |
| Selection:Female:Background | 0.414 | 1 | 0.520 |
| Selection:Female:Replicate | 5.153 | 2 | 0.076 |
| Selection:Background:Replicate | 2.531 | 2 | 0.282 |
| Female:Background:Replicate | 1.481 | 2 | 0.477 |
| Selection:Female:Background:Replicate | 0.972 | 2 | 0.615 |
No post hoc contrasts were required for this analysis.
alpha_adj <- 1 - (0.95)^(1/12)
em <- emmeans(m_mc,
~ Selection | Female * Background * Replicate)
contrasts <- pairs(em) %>% as.data.frame()
#rep_contrasts(contrasts, alpha_adj, "Table S2.2: Male mating success contrasts") %>%
#tab_options(table.font.size = px(13), #data_row.padding = px(4))
plotDat <- make_emm(m_mc, response = T)
contrasts_df <- sig_ext(contrasts)
plot_glm_means_ci(plotDat, contrasts_df, title="Mating success") +
labs(
x = "Genetic background",
y = "Proportion of successful trials",
colour = "Selection"
)
sim_res <- simulateResiduals(m_mc)
plot(sim_res)
par(mfrow = c(2,2))
testDispersion(sim_res)
##
## DHARMa nonparametric dispersion test via sd of residuals fitted vs.
## simulated
##
## data: simulationOutput
## dispersion = 1.0001, p-value = 0.992
## alternative hypothesis: two.sided
testOutliers(sim_res)
##
## DHARMa outlier test based on exact binomial test with approximate
## expectations
##
## data: sim_res
## outliers at both margin(s) = 14, observations = 1108, p-value = 0.08833
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
## 0.006924627 0.021109226
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 )
## 0.01263538
testUniformity(sim_res)
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: simulationOutput$scaledResiduals
## D = 0.024123, p-value = 0.5393
## alternative hypothesis: two-sided
M_MC <- M_MC %>% filter(Mated.male == "wt",
(Mating.end.time - Mating.start.time) > 0,
(Mating.start.time - Obs.start.time) > 0)
lm(log(latency + 1) ~ Selection x Female x Background x Replicate)
Successful ML males displayed lower latency to mating than MC males, mating approximately 18% faster on average (14.1 min vs 17.2 min). This likely reflects the greater mating success observed above
m_ml <- lm(
log((Mating.start.time - Obs.start.time) + 1) ~
Selection*Female*Background*Replicate,
data = na.omit(M_MC)
)
rep_anova(
car::Anova(m_ml),
title = "Table S3: Mating latency"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
| Table S3: Mating latency | ||||
| Term | Sum Sq | Df | F value | Pr(>F) |
|---|---|---|---|---|
| Selection | 2.725 | 1 | 3.907 | 0.049 |
| Female | 0.149 | 1 | 0.214 | 0.644 |
| Background | 0.191 | 1 | 0.274 | 0.601 |
| Replicate | 2.937 | 2 | 2.106 | 0.123 |
| Selection:Female | 0.048 | 1 | 0.069 | 0.792 |
| Selection:Background | 0.136 | 1 | 0.195 | 0.659 |
| Female:Background | 1.447 | 1 | 2.075 | 0.150 |
| Selection:Replicate | 2.453 | 2 | 1.759 | 0.173 |
| Female:Replicate | 1.104 | 2 | 0.791 | 0.454 |
| Background:Replicate | 0.163 | 2 | 0.117 | 0.890 |
| Selection:Female:Background | 0.055 | 1 | 0.078 | 0.780 |
| Selection:Female:Replicate | 2.732 | 2 | 1.959 | 0.142 |
| Selection:Background:Replicate | 0.155 | 2 | 0.111 | 0.895 |
| Female:Background:Replicate | 0.876 | 2 | 0.628 | 0.534 |
| Selection:Female:Background:Replicate | 2.028 | 2 | 1.454 | 0.235 |
| Residuals | 363.338 | 521 | ||
No post hoc contrasts were required for this analysis.
alpha_adj <- 1 - (0.95)^(1)
plotDat <- make_emm(m_ml, response = F)
plot_lm_means_ci(plotDat, NULL, title="Mating latency") +
labs(
x = "Genetic background",
y = "log(latency+1)",
colour = "Selection"
)
par(mfrow = c(2,2))
plot(m_ml)
par(mfrow = c(1,1))
Residual diagnostics. Residuals deviate modestly from normality; however, the deviations are minor and the model is expected to remain robust to them.
hist(
resid(m_ml),
main = "Residual distribution",
xlab = "Residuals"
)
shapiro.test(resid(m_ml))
##
## Shapiro-Wilk normality test
##
## data: resid(m_ml)
## W = 0.97227, p-value = 1.228e-08
# already covered above
lm(Duration ~ Selection x Female x Background x Replicate)
MC males mated for longer durations on average, mating approximately 6% longer than ML males (20.6 min vs 19.2 min). If mating duration reflects sperm investment or transfer, this suggests that ML males are not competitive through prolonged copulation. Alternatively, shorter mating durations may reflect the evolution of reduced mate harm.
m_md <- lm(
I(Mating.end.time - Mating.start.time) ~
Selection*Female*Background*Replicate,
data = na.omit(M_MC)
)
rep_anova(
car::Anova(m_md),
title = "Table S4: Mating duration"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
| Table S4: Mating duration | ||||
| Term | Sum Sq | Df | F value | Pr(>F) |
|---|---|---|---|---|
| Selection | 217.422 | 1 | 6.953 | 0.009 |
| Female | 223.731 | 1 | 7.155 | 0.008 |
| Background | 243.567 | 1 | 7.789 | 0.005 |
| Replicate | 178.077 | 2 | 2.847 | 0.059 |
| Selection:Female | 0.755 | 1 | 0.024 | 0.877 |
| Selection:Background | 55.051 | 1 | 1.760 | 0.185 |
| Female:Background | 1.743 | 1 | 0.056 | 0.813 |
| Selection:Replicate | 79.312 | 2 | 1.268 | 0.282 |
| Female:Replicate | 20.808 | 2 | 0.333 | 0.717 |
| Background:Replicate | 38.351 | 2 | 0.613 | 0.542 |
| Selection:Female:Background | 46.347 | 1 | 1.482 | 0.224 |
| Selection:Female:Replicate | 2.794 | 2 | 0.045 | 0.956 |
| Selection:Background:Replicate | 7.923 | 2 | 0.127 | 0.881 |
| Female:Background:Replicate | 34.590 | 2 | 0.553 | 0.576 |
| Selection:Female:Background:Replicate | 84.408 | 2 | 1.350 | 0.260 |
| Residuals | 16,291.969 | 521 | ||
No post hoc contrasts were required for this analysis.
alpha_adj <- 1 - (0.95)^(1/4)
em <- emmeans(m_md,
~ Selection | Female * Background)
contrasts <- pairs(em) %>% as.data.frame()
plotDat <- make_emm(m_md, response = F)
contrasts_df <- sig_ext(contrasts)
plot_lm_means_ci(plotDat, NULL, title="Mating duration") +
labs(
x = "Genetic background",
y = "Mating Duration (mins)",
colour = "Selection"
)
par(mfrow = c(2,2))
plot(m_md)
par(mfrow = c(1,1))
Residual diagnostics:
Residuals were broadly normally distributed, with only a small number of apparent outliers. The model is expected to be robust to these deviations.
hist(
resid(m_md),
main = "Residual distribution",
xlab = "Residuals"
)
shapiro.test(resid(m_md))
##
## Shapiro-Wilk normality test
##
## data: resid(m_md)
## W = 0.87925, p-value < 2.2e-16
M_MC <- M_MC %>% mutate(fec = Offspring_f + Offspring_m)
lm(fecundity ~ Selection x Female x Background x Replicate)
No detectable differences were observed between ML and MC males in the number of offspring sired following a successful mating.
m_fi <- lm(
fec ~
Selection*Female*Background*Replicate,
data = na.omit(M_MC)
)
rep_anova(
car::Anova(m_fi),
title = "Table S5: Offspring sired"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
| Table S5: Offspring sired | ||||
| Term | Sum Sq | Df | F value | Pr(>F) |
|---|---|---|---|---|
| Selection | 110.939 | 1 | 0.777 | 0.379 |
| Female | 107,596.815 | 1 | 753.372 | < 0.001 |
| Background | 22,515.817 | 1 | 157.651 | < 0.001 |
| Replicate | 1,106.049 | 2 | 3.872 | 0.021 |
| Selection:Female | 10.602 | 1 | 0.074 | 0.785 |
| Selection:Background | 262.289 | 1 | 1.836 | 0.176 |
| Female:Background | 3,069.929 | 1 | 21.495 | < 0.001 |
| Selection:Replicate | 81.396 | 2 | 0.285 | 0.752 |
| Female:Replicate | 416.910 | 2 | 1.460 | 0.233 |
| Background:Replicate | 67.194 | 2 | 0.235 | 0.790 |
| Selection:Female:Background | 13.843 | 1 | 0.097 | 0.756 |
| Selection:Female:Replicate | 1.242 | 2 | 0.004 | 0.996 |
| Selection:Background:Replicate | 427.150 | 2 | 1.495 | 0.225 |
| Female:Background:Replicate | 62.697 | 2 | 0.219 | 0.803 |
| Selection:Female:Background:Replicate | 443.010 | 2 | 1.551 | 0.213 |
| Residuals | 74,409.382 | 521 | ||
No post hoc contrasts were required for this analysis.
alpha_adj <- 1 - (0.95)^(1)
plotDat <- make_emm(m_fi, response = F)
plot_lm_means_ci(plotDat, NULL, title="Offspring sired") +
labs(
x = "Genetic background",
y = "Fecundity Induced",
colour = "Selection"
) + scale_y_continuous(limits = c(0, 65))
par(mfrow = c(2,2))
plot(m_fi)
par(mfrow = c(1,1))
Residuals revealed minor deviations from normality.
hist(
resid(m_fi),
main = "Residual distribution",
xlab = "Residuals"
)
shapiro.test(resid(m_fi))
##
## Shapiro-Wilk normality test
##
## data: resid(m_fi)
## W = 0.9313, p-value = 4.067e-15
M_MC <- M_MC %>%
filter(Offspring_m + Offspring_f != 0)
lm(fecundity ~ Selection x Female x Background x Replicate)
No detectable differences were observed between ML and MC males in the number of offspring sired following a successful mating.
m_bs <- glm(
cbind(Offspring_m, Offspring_f) ~
Selection*Female*Background*Replicate,
data = na.omit(M_MC),
family = "binomial"
)
rep_anova(
car::Anova(m_bs),
title = "Table S6: Brood sex ratio"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
| Table S6: Brood sex ratio | |||
| Term | LR Chisq | Df | Pr(>Chisq) |
|---|---|---|---|
| Selection | 1.955 | 1 | 0.162 |
| Female | 0.084 | 1 | 0.771 |
| Background | 0.391 | 1 | 0.532 |
| Replicate | 0.339 | 2 | 0.844 |
| Selection:Female | 2.434 | 1 | 0.119 |
| Selection:Background | 0.357 | 1 | 0.550 |
| Female:Background | 0.099 | 1 | 0.752 |
| Selection:Replicate | 5.648 | 2 | 0.059 |
| Female:Replicate | 2.306 | 2 | 0.316 |
| Background:Replicate | 4.772 | 2 | 0.092 |
| Selection:Female:Background | 0.598 | 1 | 0.439 |
| Selection:Female:Replicate | 3.564 | 2 | 0.168 |
| Selection:Background:Replicate | 0.796 | 2 | 0.672 |
| Female:Background:Replicate | 0.575 | 2 | 0.750 |
| Selection:Female:Background:Replicate | 0.639 | 2 | 0.727 |
No post hoc contrasts were required for this analysis.
alpha_adj <- 1 - (0.95)^(1)
em <- emmeans(m_bs,
~ Selection | Female * Background)
contrasts <- pairs(em) %>% as.data.frame()
contrasts_df <- sig_ext(contrasts)
plotDat <- make_emm(m_bs, response = T)
plot_glm_means_ci(plotDat, contrasts_df, title="Brood sex ratio") +
labs(
x = "Genetic background",
y = "Sex ratio (M/F)",
colour = "Selection"
)
sim_res <- simulateResiduals(m_bs)
plot(sim_res)