Statistical analyses
Measuring fertility which is a long-term adult trait when individuals are heated during different life-stages introduces significant temporal biases. We decided to measure fertility from the earliest possible time-point post-stress, and continue to measure over time. This allowed us to capture any visible loss/regain of fertility. Flies do not breed as pupae, so fertility cannot be measured immediately following heat-stress during this stage. Therefore, in order to understand how these responses change depending on life-stage, we measured fertility over a substantial period of time after stress for both pupae and adults. Due to the inherent differences this introduced, we analysed pupal and adult heat-stress separately, so comparisons of responses between stages can only be qualitative.
Data were analysed using variations on linear models. We assessed model fit by plotting patterns in residuals against fits and against predictors. All statistical analyses were completed in R (version 3.5.0), using the packages: binom (Dorai-Raj 2014), car (Fox 2011), “ggplot2” (Wickham 2016) and “survival” (Therneau 2015). We did model selection using Wald Chi-squared likelihood ratio-tests, removing non-significant interactions. We retained all main effects and reported statistics of these from type II likelihood ratio tests using the ‘Anova’ function from the ‘car’ package (Fox 2011).
1a) Pupal survival after heat-stress
We chose 36°C as our single experimental ‘hardening’ temperature since it is the highest temperature that does not reduce fertility when males experience it for 4h (Walsh et al. 2020; Parratt et al.2021). We analysed pupal survival after heat stress using a logistic regression with survival as a Bernoulli response variable. Stress temperature, hardening treatment (non-hardened or hardened at 36°C), and their interaction were fitted as explanatory variables. To determine whether the hardening temperature altered its protective effect, we analysed pupal survival of all flies hardened at 34, 35, and 36°C prior to heat stress at the key stress temperature of 40°C where protection is observed. We performed a logistic regression with survival as a Bernoulli response variable. We used hardening temperature as the explanatory variable. Note that the 34 and 35°C hardening temperatures were not measured at 37 and 38°C temperature stress at this preliminary stage, as these temperatures are non-lethal after a 4h stress (Walshet al. 2020).
1b) Adult survival after heat-stress
As every fly stressed at control temperatures (23°C) survived, we analysed adult survival at the chosen stress temperature (38°C) only, using a logistic regression with survival as a Bernoulli response variable and sex (male or female), hardening treatment (non-hardened or hardened), and their interaction as explanatory variables.
2a) Pupal fertility over time
We analysed the effect of heat stress on fertility over time with inverse Cox proportional hazard survival analyses (using the “survival” package (Therneau 2015)). This allowed us to model the time in days post-eclosion until focal individuals become fertile. We fit the time point at which fertility (scored as the presence of larvae) was observed as our response variable with heat treatment (benign or stress), hardening treatment (non-hardened or hardened) and their interaction as independent variables.
2b) Adult fertility over time
We examined whether there was an immediate effect of heat stress on fertility, and whether hardening affects this response. We used a logistic regression with day 1 fertility as a Bernoulli response variable and stress (benign or stressed), hardening treatment (non-hardened or hardened), and their interaction as explanatory variables.
Adult fertility over time was analysed using two separate approaches due to the observed delayed sterility and how the experimental design was constructed around it. This allowed us to pull apart different hypotheses and test them. We first tested whether heat-stress reduced fertility from day 7 onwards compared to benign temperature controls, due to delays in adult sterility. To do this we used a mixed effect logistic regression on non-hardened flies, with fertility as a Bernoulli response variable and stress, time, and their interaction as explanatory variables. Fly ID was used as a random effect to account for non-independence in the data.
We then tested whether hardening can improve fertility over time in stressed males. We used a mixed effect logistic regression on stressed flies, with fertility as a Bernoulli response variable and hardening, time, and their interaction as explanatory variables. Fly ID was used as a random effect to account for repeated measures in the data.