1 CRF

1.0.1 Data import and formatting

M_CRF <- read.csv("M_CRF_combined.csv")
M_CRF <- standardise_levels(M_CRF)

1.1 Global model.

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

1.2 Contrast testing.

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

1.3 Dataset visualisation

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"
  )


1.4 Assumption checks

Show assumption checks
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))

2 MC success

2.0.1 Data import and formatting

M_MC <- read.csv("M_MC_combined.csv")
M_MC <- standardise_levels(M_MC)
M_MC$Success <- as.integer(M_MC$Mated.male == "wt")

2.1 Global model.

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

2.2 Contrast testing.

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))

2.3 Dataset visualisation

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"
  )


2.4 Assumption checks

Show assumption checks
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

3 MC latency

3.0.1 Data import and filtering

M_MC <- M_MC %>% filter(Mated.male == "wt",
    (Mating.end.time - Mating.start.time) > 0,
    (Mating.start.time - Obs.start.time) > 0)

3.1 Global model

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


3.2 Contrast testing

No post hoc contrasts were required for this analysis.

alpha_adj <- 1 - (0.95)^(1)

3.3 Dataset visualisation

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"
  )


3.4 Assumption checks

Show assumption checks
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

4 MC duration

4.0.1 Data import and filtering

# already covered above

4.1 Global model

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


4.2 Contrast testing

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()

4.3 Dataset visualisation

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"
  )


4.4 Assumption checks

Show assumption checks
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

5 MC fecundity induction

5.0.1 Data import and formatting

M_MC <- M_MC %>% mutate(fec = Offspring_f + Offspring_m)

5.1 Global model

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


5.2 Contrast testing

No post hoc contrasts were required for this analysis.

alpha_adj <- 1 - (0.95)^(1)

5.3 Dataset visualisation

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))


5.4 Assumption checks

Show assumption checks
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

6 MC Brood sex ratios

6.0.1 Data import and formatting

M_MC <- M_MC %>%
  filter(Offspring_m + Offspring_f != 0)

6.1 Global model

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

6.2 Contrast testing

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)

6.3 Dataset visualisation

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"
  )


6.4 Assumption checks

Show assumption checks
sim_res <- simulateResiduals(m_bs)

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.98237, p-value = 0.504
## 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) = 8, observations = 515, p-value = 0.07304
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.006729707 0.030377776
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                             0.01553398
testUniformity(sim_res)
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.040879, p-value = 0.3557
## alternative hypothesis: two-sided

7 SC sperm offense

7.0.1 Data import and formatting

M_SC <- read.csv("M_SC_combined.csv")
M_SC <- standardise_levels(M_SC)

7.1 Global model

glmmTMB(cbind(Competitor offspring, Target offspring) ~ Selection x Female x Background x Replicate + (1|Contest), family = betabinomial)

This analysis models sperm defense (1 - P2 -> modified to solve an overdispersion issue), representing the probability that the first (competitor) male successfully defended paternity against the focal second male (ML or MC). No detectable differences were observed between ML and MC males in sperm offense ability. Model-estimated probabilities of successful second-male paternity were 83.4% for ML males and 81.6% for MC males.

m_sc <- glmmTMB(
  cbind(U, WT) ~
    Selection*Female*Background*Replicate +
    (1|Contest),
  data = M_SC,
  family = "betabinomial"
)

rep_anova(
  car::Anova(m_sc),
  title = "Table S7: Sperm offense"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
Table S7: Sperm offense
Term Chisq Df Pr(>Chisq)
Selection 1.573 1 0.210
Female 115.819 1 < 0.001
Background 69.423 1 < 0.001
Replicate 1.937 2 0.380
Selection:Female 0.001 1 0.974
Selection:Background < 0.001 1 0.997
Female:Background 74.341 1 < 0.001
Selection:Replicate 2.017 2 0.365
Female:Replicate 1.846 2 0.397
Background:Replicate 0.953 2 0.621
Selection:Female:Background 0.750 1 0.387
Selection:Female:Replicate 0.567 2 0.753
Selection:Background:Replicate 5.094 2 0.078
Female:Background:Replicate 0.468 2 0.791
Selection:Female:Background:Replicate 5.029 2 0.081

7.2 Contrast testing

No post hoc contrasts were required for this analysis.

alpha_adj <- 1 - (0.95)^(1/4)
em <- emmeans(m_sc,
  ~ Selection | Female * Background * Replicate)

contrasts <- pairs(em) %>% as.data.frame()
contrasts_df <- sig_ext(contrasts)

7.3 Dataset visualisation

plotDat <- make_emm(m_sc, response = T)
plot_glm_means_ci(plotDat, contrasts_df, title="Sperm offense") + 
  labs(
    x = "Genetic background",
    y = "Competitor Sperm Defense (1-P2)",
    colour = "Selection"
  )


7.4 Assumption checks

Show assumption checks
sim_res <- simulateResiduals(m_sc)

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.83713, p-value = 0.152
## 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) = 16, observations = 1152, p-value = 0.0305
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.007958981 0.022456923
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                             0.01388889
testUniformity(sim_res)
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.015765, p-value = 0.937
## alternative hypothesis: two-sided

8 MH CG Mate Harm

8.0.1 Data import and formatting

M_MH <- read.csv("M_MH_CG.csv")
M_MH <- standardise_levels(M_MH)

MH <- M_MH[,-5] %>%
  pivot_longer(
    cols = starts_with("Day"),
    names_to = "Day",
    names_prefix = "Day",
    values_to = "alive"
  ) %>%
  mutate(Day = as.numeric(Day)) %>%
  group_by(Contest) %>%
  mutate(
    at_risk = lag(alive),
    deaths = at_risk - alive
  ) %>% ungroup()

8.1 Global model

glmer((deaths, survival) ~ Selection x Background x Replicate x Day + (1|Contest), family = binomial)

CG Female survivorship across seven days (under continuous exposure to males during days 0–2, followed by male removal) was modelled using a discrete-time survival model. Females housed with ML males displayed consistently higher survivorship than those housed with MC males. Survivorship declined more sharply during the cohabitation phase in both treatments. Final survival probabilities were estimated at approximately 59% for ML treatments and 45% for MC treatments.

m_mh <- glmer(
  cbind(deaths, at_risk - deaths) ~ 
    Selection * Background * Replicate * factor(Day) + (1|Contest),
  data = MH, 
  family = binomial)

rep_anova(
  car::Anova(m_mh),
  title = "Table S8: Mate harm / Clone Generator female survival"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
Table S8: Mate harm / Clone Generator female survival
Term Chisq Df Pr(>Chisq)
Selection 22.910 8 0.003
Background 22.033 6 0.001
Replicate 8.681 9 0.467
factor(Day) 332.301 18 < 0.001
Selection:Background 3.099 4 0.541
Selection:Replicate 2.722 4 0.605
Background:Replicate 5.996 4 0.199
Selection:factor(Day) 7.546 11 0.753
Background:factor(Day) 10.936 10 0.363
Replicate:factor(Day) 9.966 16 0.868
Selection:Background:Replicate 0.980 2 0.613
Selection:Background:factor(Day) 1.364 6 0.968
Selection:Replicate:factor(Day) 9.410 12 0.668
Background:Replicate:factor(Day) 13.290 12 0.348
Selection:Background:Replicate:factor(Day) 8.226 12 0.767

8.2 Contrast testing

No post hoc contrasts were required for this analysis.

alpha_adj <- 1 - (0.95)^(1/2)
em <- emmeans(m_mh,  ~ Selection | Background * factor(Day))
contrasts <- pairs(em) %>% as.data.frame()

#rep_contrasts(contrasts, alpha_adj, 
#              "Table S8.2: Mate Harm") %>% #tab_options(table.font.size = px(13), data_row.padding = px(4))

8.3 Dataset visualisation

plotDat <- emmeans(m_mh,
  ~ Selection * Background * Day,
  type = "response") %>%
  as.data.frame() %>%
  arrange(Selection, Background, Day) %>%
  group_by(Selection, Background) %>%
  mutate(
    survival = cumprod(1 - prob)
  )
d0 <- plotDat %>% distinct(Selection, Background) %>%
  mutate(Day = 0, survival = 1); plotDat <- bind_rows(d0, plotDat)


contrasts_df <- sig_ext(contrasts) 

ggplot(plotDat, aes(x = Day, y = survival, colour = Selection)) +
  geom_line() +
  geom_text(data = contrasts_df,
    aes(x = 3.5, y = 0.95, label = sig), inherit.aes = FALSE, size = 6) +
facet_wrap(~ Background, labeller = as_labeller(
      function(x) paste("Genetic background:", x))) +
  
  labs(title = "Mate harm / CG female survival",
    x = "Time", y = "Proportion of survivors",
    colour = "Selection"
  ) +
  
  scale_y_continuous(limits = c(0, 1)) + theme_classic(base_size = 14) +
  
  theme(plot.title = element_text(
      face = "bold", hjust = 0.5, size = 16),
    strip.background = element_blank(),
    strip.text = element_text(face = "bold", size = 12),
    axis.title = element_text(face = "bold"),
    legend.position = "right", legend.title = element_text(face = "bold"),
    panel.spacing = unit(1, "lines")
  )


8.4 Assumption checks

Show assumption checks
sim_res <- simulateResiduals(m_mh)

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.91996, p-value = 0.36
## 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) = 12, observations = 840, p-value = 0.04938
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.007402845 0.024821187
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                             0.01428571
testUniformity(sim_res)
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.024811, p-value = 0.6793
## alternative hypothesis: two-sided

9 MH CG female fecundity

9.0.1 Data import and formatting

# no need for input

9.1 Global model

lm(Productivity ~ Selection x Background x Replicate)

In addition to improving female survivorship, ML males were also associated with greater offspring production. However, this effect depended on the genetic background in which males were tested, with the productivity benefit observed only under the WT background.

m_pr <- lm(
  Productivity ~
    Selection*Background*Replicate,
  data = na.omit(M_MH)
)

rep_anova(
  car::Anova(m_pr),
  title = "Table S9.1: CG female productivity"
) %>% tab_options(table.font.size = px(13), data_row.padding = px(4))
Table S9.1: CG female productivity
Term Sum Sq Df F value Pr(>F)
Selection 7,760.208 1 21.924 < 0.001
Background 58,124.008 1 164.209 < 0.001
Replicate 430.317 2 0.608 0.546
Selection:Background 11,505.208 1 32.504 < 0.001
Selection:Replicate 63.517 2 0.090 0.914
Background:Replicate 363.217 2 0.513 0.600
Selection:Background:Replicate 1,171.217 2 1.654 0.196
Residuals 38,228.100 108


9.2 Contrast testing

Multiple-testing correction. Adjusted alpha for 2 contrast tests: ~0.025

alpha_adj <- 1 - (0.95)^(1/2)

em <- emmeans(m_pr,  ~ Selection | Background)
contrasts <- pairs(em) %>% as.data.frame()

rep_contrasts(contrasts, alpha_adj, 
              "Table S9.2: CG female productivity") %>% 
  tab_options(table.font.size = px(13), data_row.padding = px(4))
Table S9.2: CG female productivity
contrast Background estimate SE df t.ratio p.value
ML - MC CG −3.500 4.858 108 −0.721 0.473
ML - MC C 35.667 4.858 108 7.342 < 0.001

9.3 Dataset visualisation

plotDat <- as.data.frame(emmeans(m_pr, ~ Selection * Background))
contrasts_df <- sig_ext(contrasts)

ggplot(plotDat, aes(x = Background, y = emmean, colour = Selection)) +
    geom_point(position = position_dodge(width = 0.25), size = 2.2) +
    geom_errorbar(aes(ymin = lower.CL, ymax = upper.CL),
                  width = 0.15, linewidth = 0.7,
                  position = position_dodge(width = 0.25)) +
  
    geom_text(data = contrasts_df, aes(x = Background, y = 125, label = sig),
      inherit.aes = FALSE, size = 5) +

    labs(title = "CG female productivity", 
         x = "Genetic background", y = "Estimated mean ± 95% CI", 
         colour = "Selection") +
    scale_y_continuous(limits = c(0,150), expand = expansion(mult = c(0, 0.02))) +
    
    theme_classic(base_size = 14) +
    theme(plot.title = element_text(face = "bold", hjust = 0.5, size = 16),
      axis.title = element_text(face = "bold"),
      legend.position = "right",
      legend.title = element_text(face = "bold"))


9.4 Assumption checks

Show assumption checks
par(mfrow = c(2,2))
plot(m_pr)

par(mfrow = c(1,1))
hist(
  resid(m_pr),
  main = "Residual distribution",
  xlab = "Residuals"
)

shapiro.test(resid(m_pr))
## 
##  Shapiro-Wilk normality test
## 
## data:  resid(m_pr)
## W = 0.99696, p-value = 0.9971

10 Isolated CG genetic effects

10.0.1 Data import and formatting

CG <- list(
  f_Auto = read.csv("ArtF_autoCRF.csv"),
  m_Auto = read.csv("ArtM_autoCRF.csv"),
  f_Cyto = read.csv("ArtF_cytoCRF.csv"),
  m_Cyto = read.csv("ArtM_cytoCRF.csv"),
  m_Y    = read.csv("ArtM_yCRF.csv")
)

cols <- c("Replicate", "Contest", "Cyto", "Auto", "Y")
CG <- map(CG, \(df) {
  df[cols] <- map(df[cols], factor)
  df$Selection <- factor(df$Selection, levels = c("ML", "MC"))
  df})

10.1 Global models

glmer((target offspring, competitor offspring) ~ Selection x Replicate + (1|Contest), family = binomial).

Given that in the absence of artefacts, the fitness difference between ML and MC males is marginal, any ML advantage in the presence of a given artefact suggests either compensatory adaptation to its imposed cost or epistatic coupling between the adaptive response and said genetic element. Likewise, in the absence of CG elements, ML females exhibit lower fitness than MC females. Persistence of this pattern in the presence of a ML-adapted CG element (MC > ML female fitness) suggests sex-specific or sexually antagonistic effects, whereas recovery of ML female fitness indicates concordant fitness benefits across sexes

We find the following:

CG genetic element ML male response ML female response
CG cytoplasm Fitness benefit Fitness recovery
CG autosomes No fitness benefit No fitness recovery
CG Y chromosome Fitness benefit Not applicable
cg <- map(CG, \(dat) {
  glmer(
    cbind(WT, U) ~ Selection * Replicate + (1 | Contest),
    data = dat,
    family = binomial
  )
})

anova_list <- imap(cg, \(mod, nm) {
  car::Anova(mod, type = 2) %>%
    as.data.frame() %>%
    rownames_to_column("term") %>%
    mutate(dataset = nm)
})

anova_df <- bind_rows(anova_list) %>%
  mutate(model = case_when(
      dataset == "f_Auto" ~ "S10.1a: CG autosomes in females",
      dataset == "m_Auto" ~ "S10.1b: CG autosomes in males",
      dataset == "f_Cyto" ~ "S10.1c: CG cytoplasm in females",
      dataset == "m_Cyto" ~ "S10.1d: CG cytoplasm in males",
      dataset == "m_Y"    ~ "S10.1e: CG Y chromosome in males"),
    
    sig = `Pr(>Chisq)` < 0.05,
    Chisq = ifelse(Chisq < 0.001,"< 0.001", sprintf("%.3f", round(Chisq, 3))),
    `Pr(>Chisq)` = ifelse(`Pr(>Chisq)` < 0.001,"< 0.001", 
                          sprintf("%.3f", round(`Pr(>Chisq)`, 3)))) %>%
    select(model,term,Chisq,Df,`Pr(>Chisq)`,sig)

anova_df %>%
  gt(groupname_col = "model",rowname_col = "term") %>%
  cols_label(Chisq = "Chi-sq", Df = "Df", `Pr(>Chisq)` = "Pr(>Chisq)") %>%
  cols_hide(columns = sig) %>% tab_style(style = list(cell_fill(color = "#DFF0D8")),
  locations = cells_body(rows = sig == TRUE)) %>%
  tab_options(table.font.size = px(13), data_row.padding = px(4))
Chi-sq Df Pr(>Chisq)
S10.1a: CG autosomes in females
Selection 31.838 1 < 0.001
Replicate 12.613 2 0.002
Selection:Replicate 20.751 2 < 0.001
S10.1b: CG autosomes in males
Selection 2.608 1 0.106
Replicate 0.706 2 0.702
Selection:Replicate 1.215 2 0.545
S10.1c: CG cytoplasm in females
Selection 0.227 1 0.634
Replicate 9.217 2 0.010
Selection:Replicate 10.280 2 0.006
S10.1d: CG cytoplasm in males
Selection 5.672 1 0.017
Replicate 0.039 2 0.981
Selection:Replicate 5.943 2 0.051
S10.1e: CG Y chromosome in males
Selection 36.657 1 < 0.001
Replicate 31.006 2 < 0.001
Selection:Replicate 12.860 2 0.002

10.2 Contrast testing

Contrast testing conducted for 3 models with Selection:Replicate interactions.

Multiple-testing correction: Adjusted alpha for 3 contrast tests: ~0.017

alpha_adj <- 1 - (0.95)^(1/3)

cg_sub <- cg[c("f_Auto", "f_Cyto", "m_Y")]

contrast_df <- imap_dfr(cg_sub, \(mod, nm) {
  em <- emmeans(mod, ~ Selection | Replicate)
  pairs(em) %>% 
    as.data.frame() %>%
    mutate(dataset = nm)
})

contrast_gt_df <- contrast_df %>%
  mutate(
    model = case_when(
      dataset == "f_Auto" ~ "S10.2a: CG autosomes in females",
      dataset == "f_Cyto" ~ "S10.2b: CG cytoplasm in females",
      dataset == "m_Y"    ~ "S10.2c: CG Y chromosome in males"),
    
    sig = p.value < alpha_adj,
    
    estimate = ifelse(abs(estimate) < 0.001, "< 0.001",
      sprintf("%.3f", round(estimate, 3))),
    
    SE = ifelse(abs(SE) < 0.001,"< 0.001",
      sprintf("%.3f", round(SE, 3))),
    
    z.ratio = ifelse(abs(z.ratio) < 0.001,"< 0.001",
      sprintf("%.3f", round(z.ratio, 3))),
    
    p.value = ifelse(p.value < 0.001,"< 0.001",
      sprintf("%.3f", round(p.value, 3)))) %>%
  
  select(model,Replicate,contrast,estimate,SE,z.ratio,p.value,sig)

contrast_gt_df %>%
  gt(groupname_col = "model",rowname_col = "Replicate") %>%
  cols_label(contrast = "Contrast",estimate = "Estimate",SE = "SE",z.ratio = "z",p.value = "p") %>%
  cols_hide(columns = sig) %>%
  tab_style(style = list(cell_fill(color = "#DFF0D8")),
    locations = cells_body(rows = sig == TRUE)) 
Contrast Estimate SE z p
S10.2a: CG autosomes in females
1 ML - MC 0.009 0.092 0.101 0.919
3 ML - MC -0.327 0.093 -3.520 < 0.001
5 ML - MC -0.579 0.091 -6.339 < 0.001
S10.2b: CG cytoplasm in females
1 ML - MC 0.130 0.102 1.276 0.202
3 ML - MC 0.084 0.092 0.907 0.364
5 ML - MC -0.259 0.091 -2.838 0.005
S10.2c: CG Y chromosome in males
1 ML - MC 0.528 0.124 4.253 < 0.001
3 ML - MC 0.730 0.131 5.572 < 0.001
5 ML - MC 0.081 0.131 0.618 0.537

10.3 Dataset visualisation

emm_df <- imap_dfr(cg, \(mod, nm) {
  em <- emmeans(mod, ~ Selection, type = "response")
  as.data.frame(em) %>% mutate(dataset = nm)
})

contrast_df <- imap_dfr(cg, \(mod, nm) {
  em <- emmeans(mod, ~ Selection, type = "response")
  pairs(em) %>% as.data.frame() %>%
    mutate(
      dataset = nm,
      sig = case_when(
        p.value < 0.001 ~ "***",
        p.value < 0.01  ~ "**",
        p.value < 0.05  ~ "*",
        TRUE ~ ""
      )
    )
})

facet_labs <- c(
  f_Auto = "CG autosomes: ♀",
  m_Auto = "CG autosomes: ♂",
  f_Cyto = "CG cytoplasm: ♀",
  m_Cyto = "CG cytoplasm: ♂",
  m_Y    = "CG Y chr: ♂"
)

ggplot(emm_df, aes(x = Selection, y = prob, colour = Selection)) +
    
  geom_point(size = 2) +
  
  geom_errorbar(aes(ymin = asymp.LCL, ymax = asymp.UCL),
                width = 0.12, linewidth = 0.7) +
  
  geom_text(data = contrast_df, aes(x = 1.5, y = 1.0, label = sig),
      inherit.aes = FALSE, colour = "black", size = 5) +
    
  facet_wrap(~ dataset, nrow = 1, labeller = as_labeller(facet_labs)) +
    
  labs(title = "Isolated CG genetic effects", 
       y = "Proportion of offspring", colour = "Selection")  +
  scale_y_continuous(limits = c(0,1.05)) +
  theme_classic(base_size = 14) +
  theme(plot.title = element_text(face = "bold", hjust = 0.5, size = 16),
    strip.background = element_blank(),
    strip.text = element_text(face = "bold", size = 8),
    axis.text.x = element_text(face = "bold"),
    axis.title.y = element_text(face = "bold"),
    legend.title = element_text(face = "bold"),
    panel.spacing = unit(1, "lines"))


10.4 Assumption checks

Show assumption checks
diagnostics <- imap(cg, \(mod, nm) {
  
  model_name <- case_when(
    nm == "f_Auto" ~ "CG autosomes in females",
    nm == "m_Auto" ~ "CG autosomes in males",
    nm == "f_Cyto" ~ "CG cytoplasm in females",
    nm == "m_Cyto" ~ "CG cytoplasm in males",
    nm == "m_Y"    ~ "CG Y chromosome in males"
  )
  
  cat("\n========================\n")
  cat("Model:", model_name, "\n")
  cat("========================\n")
  
  sim_res <- simulateResiduals(mod)
  
  # residual plots
  plot(sim_res)
  
  # diagnostic tests
  disp <- testDispersion(sim_res)
  out  <- testOutliers(sim_res)
  uni  <- testUniformity(sim_res)
  
  print(disp)
  print(out)
  print(uni)
  
  list(
    sim_res = sim_res,
    dispersion = disp,
    outliers = out,
    uniformity = uni
  )
  
})
## 
## ========================
## Model: CG autosomes in females 
## ========================

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 1.0591, p-value = 0.512
## alternative hypothesis: two.sided
## 
## 
##  DHARMa bootstrapped outlier test
## 
## data:  sim_res
## outliers at both margin(s) = 2, observations = 216, p-value = 0.94
## alternative hypothesis: two.sided
##  percent confidence interval:
##  0.00000000 0.02314815
## sample estimates:
## outlier frequency (expected: 0.00791666666666667 ) 
##                                        0.009259259 
## 
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.044742, p-value = 0.7802
## alternative hypothesis: two-sided
## 
## 
## ========================
## Model: CG autosomes in males 
## ========================

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 0.50733, p-value < 2.2e-16
## alternative hypothesis: two.sided
## 
## 
##  DHARMa bootstrapped outlier test
## 
## data:  sim_res
## outliers at both margin(s) = 0, observations = 216, p-value = 0.36
## alternative hypothesis: two.sided
##  percent confidence interval:
##  0.00000000 0.03020833
## sample estimates:
## outlier frequency (expected: 0.0099537037037037 ) 
##                                                 0 
## 
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.055708, p-value = 0.514
## alternative hypothesis: two-sided
## 
## 
## ========================
## Model: CG cytoplasm in females 
## ========================

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 0.97156, p-value = 0.624
## alternative hypothesis: two.sided
## 
## 
##  DHARMa bootstrapped outlier test
## 
## data:  sim_res
## outliers at both margin(s) = 3, observations = 209, p-value = 0.56
## alternative hypothesis: two.sided
##  percent confidence interval:
##  0.00000000 0.02643541
## sample estimates:
## outlier frequency (expected: 0.0100956937799043 ) 
##                                        0.01435407 
## 
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.035906, p-value = 0.9504
## alternative hypothesis: two-sided
## 
## 
## ========================
## Model: CG cytoplasm in males 
## ========================

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 0.95513, p-value = 0.752
## alternative hypothesis: two.sided
## 
## 
##  DHARMa bootstrapped outlier test
## 
## data:  sim_res
## outliers at both margin(s) = 1, observations = 192, p-value = 0.92
## alternative hypothesis: two.sided
##  percent confidence interval:
##  0.00000000 0.03645833
## sample estimates:
## outlier frequency (expected: 0.0103645833333333 ) 
##                                       0.005208333 
## 
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.054642, p-value = 0.6152
## alternative hypothesis: two-sided
## 
## 
## ========================
## Model: CG Y chromosome in males 
## ========================

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 0.91067, p-value = 0.424
## alternative hypothesis: two.sided
## 
## 
##  DHARMa bootstrapped outlier test
## 
## data:  sim_res
## outliers at both margin(s) = 0, observations = 180, p-value = 0.54
## alternative hypothesis: two.sided
##  percent confidence interval:
##  0.00000000 0.03069444
## sample estimates:
## outlier frequency (expected: 0.00844444444444445 ) 
##                                                  0 
## 
## 
##  Asymptotic one-sample Kolmogorov-Smirnov test
## 
## data:  simulationOutput$scaledResiduals
## D = 0.06064, p-value = 0.5222
## alternative hypothesis: two-sided

11 Breeding designs

11.1 Figure S1.

S1(a) ML selection breeding design. S1(b) Recombination box design.

Females denoted as DTP in the schematic represent clone-generator (CG) females carrying translocated autosomes marked with recessive eye-colour markers. Where indicated, females denoted as DTW instead represent CG females carrying translocated autosomes marked with dominant eye-colour markers.

11.2 Figure S2.

S2(a) HC males and S2(b) WT males used for CRF assays and mating success and sperm offense assays.

11.3 Figure S3.

Single artefact males carrying: S3(a) CG cytoplasm, S3(b) CG Y chromosome, and S3(c) CG autosomes

11.4 Figure S4.

Single artefact females carrying S4(a) CG cytoplasm and S4(b) CG autosomes

12 List of abbreviations

library(kableExtra)

abbr_tbl <- tibble::tribble(
  ~Factor,       ~Abbreviation, ~Meaning,
  
  "Selection",   "ML",          "Male limited",
  "Selection",   "MC",          "Matched control",
  
  "Female",      "C",           "Control",
  "Female",      "CG",          "Clone generator",
  
  "Background",  "C",           "Control",
  "Background",  "CG",          "Clone generator",
  
  "Replicate",   "1",           "Replicate 1",
  "Replicate",   "3",           "Replicate 3",
  "Replicate",   "5",           "Replicate 5"
)

abbr_tbl$Factor <- factor(abbr_tbl$Factor, levels = unique(abbr_tbl$Factor))

group_sizes <- table(abbr_tbl$Factor) 
group_sizes <- group_sizes[levels(abbr_tbl$Factor)]

abbr_tbl %>%
  select(-Factor) %>%
  kable(
    booktabs = TRUE,
    linesep = "",
    align = c("c", "l"),
    col.names = c("Abbreviation", "Description")
  ) %>%
  kable_styling(
    full_width = FALSE,
    position = "left",
    font_size = 11
  ) %>%
  pack_rows(
    index = group_sizes,
    bold = TRUE
  )
Abbreviation Description
Selection
ML Male limited
MC Matched control
Female
C Control
CG Clone generator
Background
C Control
CG Clone generator
Replicate
1 Replicate 1
3 Replicate 3
5 Replicate 5