# Host-mediated, cross-generational intraspecific competition in a multivoltine herbivore species

Bastien Castagneyrol, Inge van Halder, Yasmine Kadiri, Laura Schillé, Hervé Jactel

► To cite this version:

Bastien Castagneyrol, Inge van Halder, Yasmine Kadiri, Laura Schillé, Hervé Jactel. Host-mediated, cross-generational intraspecific competition in a multivoltine herbivore species. 2021. hal-03276170

HAL Id: hal-03276170

https://hal.inrae.fr/hal-03276170

Preprint submitted on 1 Jul 2021

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Host-mediated, cross-generational intraspecific competition in a
multivoltine herbivore species

Bastien Castagneyrol¹,*,

Inge van Halder¹

Yasmine Kadiri¹

Laura Schillé¹

Hervé Jactel¹

¹ Univ. Bordeaux, INRAE, BIOGECO, F-33612 Cestas, France

* Bastien Castagneyrol, INRAE UMR BIOGECO, 69 route d'Arcachon, FR-33612 Cestas Cedex, France ; bastien.castagneyrol@inrae.fr

August 9, 2020

Conspecific insect herbivores co-occurring on the same host plant interact both directly through interference competition and indirectly through exploitative competition, plant-mediated interactions and enemy-mediated interactions. However, the situation is less clear when the interactions between conspecific insect herbivores are separated in time within the same growing season, as it is the case for multivoltine species. We hypothesized that early season herbivory would result in reduced egg laying and reduced performance of the next generation of herbivore on previously attacked plants. We tested this hypothesis in a choice experiment with box tree moth females, *Cydalima perspectalis* Walker (Lepidoptera: Crambidae), to which box trees, *Buxus sempervirens* L. (Buxaceae), were proposed that had or had not been previously defoliated by BTM larvae earlier in the season. We then compared the performance of the next generation larvae on previously damaged vs undamaged plants. Previous herbivory had no effect on oviposition behaviour, but the weight of next generation larvae was significantly lower in previously damaged plants. There was a negative correlation between the number of egg clutches per plant and larval performance. Overall, our findings reveal that early season herbivory reduces the performance of conspecific individuals on the same host plant later in the growing season, and that this time-lagged intraspecific competition results from a mismatch between the oviposition preference of females and the performance of their offspring.

# 1 Introduction

Insect herbivores exploiting the same plant can compete for food, even when interactions among individuals are separated in time (Kaplan & Denno, 2007). Insects may thus reduce the impact of inter- and intraspecific competition by avoiding crowded plants, or plants that have been previously consumed by herbivores, which supposes that they can detect competitors or their effects on plants (De Moraes et al., 2001; Shiojiri & Takabayashi, 2003). For many species, the choice of the oviposition site by mated females is crucial in this respect. The preference-performance hypothesis - *aka* the ‘*mother knows best hypothesis*’ - states that female insects evolved host searching behaviour that leads them to oviposit on hosts where their offspring do best (Gripenberg et al., 2010). A good match between the preference of a mated female for a given plant and the performance of their offspring developing on the same plant implies that females can recognize cues that correlate with larval performance, in particular those related to plant defenses and nutritional quality. Yet, these cues can be largely modified by the simultaneous or sequential presence of other competing herbivores (Bultman & Faeth, 1986; Nykänen & Koricheva, 2004; Abdala-Roberts et al., 2019; Visakorpi et al., 2019). Therefore, initial herbivory may have time-lagged consequences of the preference and performance
42

43

44

45

of herbivores that subsequently attack the same plant in the same growing season (Poelman et al., 2008; Stam et al., 2014). However, while such time-lagged *interspecific* interactions between herbivores have long been documented (Faeth, 1986), surprisingly much less is known about delayed *intraspecific* interactions in multivoltine species.

46

47

48

49

50

51

52

53

54

55

56

57

58

59

Previous herbivory can influence the oviposition preference of later herbivores. Several studies have demonstrated that mated females can discriminate host plants that have been previously attacked by insect herbivores (Wise & Weinberg, 2002; Stam et al., 2014; Moura et al., 2017; Barnes & Murphy, 2018; Moreira et al., 2018; Weeraddana & Evenden, 2019). This behaviour involves the use of a mix of plant and herbivore cues to detect the passage of competitors on potential hosts. Several mechanisms can explain such indirect interactions between herbivores separated in time. First, mated females can directly detect the presence, past and possibly future presence of competitors. For instance, Averill & Prokopy (1987) showed that female *Rhagoletis pomonella* Walsh (Diptera: Tephritidae) marks its oviposition site with an epideictic pheromone that deter conspecific females from laying eggs, thus reducing intraspecific competition at the larval stage. The frass of several Lepidoptera species was also found to act as an oviposition deterrent to subsequent herbivores (Jones & Finch, 1987; Hashem et al., 2013; Molnár et al., 2017). Second, herbivory can induce changes in the physical and chemical characteristics of attacked plants (Marchand & McNeil, 2004; Blenn et al., 2012; Fatouros et al., 2012; Hilker & Fatouros, 2015; Abdala-Roberts et al., 2019), thereby reducing their attractiveness to mated females.

60

61

62

63

64

65

66

67

68

69

70

71

72

73

Previous herbivory generally reduces the performance of later herbivores. A common mechanism is that herbivory induces changes in plant quality and defenses that generally reduce the performance of late coming herbivores (Wratten et al., 1988; Agrawal, 1999; Abdala-Roberts et al., 2019). For instance, prior damage by the western tent caterpillar *Malacosoma californicum* Packard (Lepidoptera: Lasiocampidae) induces the regrowth of tougher leaves acting as physical defenses and reducing the fitness of the next tent caterpillars generation (Barnes & Murphy, 2018). However, several authors reported a mismatch between prior herbivory effects on female oviposition preference vs larval growth, consumption or survival of their offspring (Wise & Weinberg, 2002; Bergamini & Almeida-Neto, 2015; Martinez et al., 2017). For instance, Weeraddana and Evenden (2019) found that herbivory by the diamondback moth, *Plutella xylostella* (L.) (Lepidoptera: Plutellidae) on canola plants (*Brassica napus* L.) had no effect on subsequent oviposition by the bertha armyworm, *Mamestra configurata* Walker (Lepidoptera: Noctuidae) whereas its larvae had reduced growth on previously damaged plants. It follows that a sound understanding of the effect of prior herbivory on subsequent herbivory requires studying its effect on the preference and performance of later herbivores simultaneously.

74

75

76

77

78

79

80

81

82

83

84

85

86

87

The box tree moth (BTM) *Cydalima perspectalis* Walker (Lepidoptera: Crambidae) is a multivoltine moth species introduced to Europe in 2007 from Asia (Wan et al., 2014). In its native range, BTM larvae can feed on different host genera, whereas in Europe they feed exclusively on box trees (*Buxus spp*) (Wan et al., 2014). In the introduced area, the BTM overwinters at the larval stage, mainly in the third instar, such that defoliation restarts at the beginning of the growing season. In Europe, damage is aggravated by the fact that the BTM has 3-4 generations a year (Kenis et al., 2013; Matošević et al., 2017). When several pest generations successively defoliate the same box tree, there are no leaves left to eat and the caterpillars then feed on the bark, which can lead to the death of the host tree (Kenis et al., 2013; Wan et al., 2014; Alkan Akıncı & Kurdoğlu, 2019). In the present study, we investigated the consequences of defoliation by the first, spring generation of BTM larvae on the oviposition behaviour of the adults and the larval performance in the next generation. We hypothesized that early herbivory would reduce oviposition on previously attacked hosts and reduce the performance of the next generation larvae feeding on damaged hosts. By addressing the above, our study brings new insights into the understanding of cross-generational intraspecific competition in insect herbivores and further challenges the 'mother knows best hypothesis'.
# 2 Materials and methods

## 2.1 Biological material

In spring 2019, we obtained box trees from a commercial nursery and kept them in a greenhouse at INRAE Bordeaux forest research station. Box trees were on average 25 cm high and 20 cm wide. We transferred them into 5 L pots with horticultural loam. For two months, we watered them every four days from the above (i.e. watering leaves too) to remove any potential pesticide remain.

BTM larvae (L1-L3) overwinter in cocoons tied between two adjacent leaves. We initiated BTM larvae rearing with caterpillars collected in the wild in early spring 2019. We reared them at room temperature in 4320 $cm^3$ plastic boxes, and fed them *ad libitum*, with branches collected on box trees around the laboratory. At 25°C, the BTM achieves one generation in 45 days. The larval phase lasts for about 30 days. Adults live 12-15 days. A single female lays on average 800 eggs. We initiated the herbivory on box tree plants with larvae which were the offspring of the overwintering generation. Their adults were used in the preference test, and second generation larvae used in the performance test (see below).

## 2.2 Experimental design

On June 18th 2019, we haphazardly assigned box trees to *control* and *herbivory* experimental groups. The *herbivory* treatment consisted of *n* = 60 box trees that received five L3 larvae each. Larvae were allowed to feed freely for one week, after which we removed them all from plant individuals. In order to confirm that the addition of BTM larvae caused herbivory, we visually estimated BTM herbivory as the percentage of leaves consumed by BTM larvae, looking at every branch on every plant. We then averaged herbivory at the plant level. Herbivory ranged from 2 to 18% and was on average 9%. The *control* group (*n* = 61) did not receive any BTM larva. On July 8th, we randomly distributed plants of the *herbivory* and *control* treatments on a 11 × 11 grid in a greenhouse. We left 40 cm between adjacent pots, which was enough to avoid any physical contact between neighbouring plants (Figure 1, Figure 2).

<figure><img src="image_2.png" /><figcaption>Figure 1: Photos illustrating the experimental design.</figcaption></figure>
<figure><img src="image_3.png" /><figcaption>Figure 2: Experimental design. Pots were 40 cm appart. Circles and triangles represent control and non-attacked trees. Scale colour represents the number of egg clutches per box tree (log-transformed).</figcaption></figure>

The same day, we released ca 100 BTM moths that had emerged from chrysalids less than two days before (i.e., an uncontrolled mix of males and females). Moths were allowed to fly freely within the greenhouse. They could feed on small pieces of cotton imbibed with a sugar-water solution, disposed on the ground in the greenhouse.

It is important to note that at the time we released moths, there were no larvae feeding on experimental box trees anymore. In addition, at this time, plants in the herbivory treatment had been cleared of caterpillars for three weeks during which they were watered every two to three days from above. Although larval frass may have been present in pots submitted to the herbivory treatment, it should have been washed out. Finally, we carried out our experiment in an enclosed greenhouse in which the potential effect of natural enemies on BTM behaviour can be neglected. The consequences are that any effect of prior herbivory on subsequent oviposition behaviour and larval performance should have been independent of cues emitted by BTM larvae themselves or by their frass (Sato et al., 1999; Molnár et al., 2017) and therefore were only plant-mediated.

## 2.3 BTM host choice

In order to test whether initial defoliation of focal plants influenced host choice for oviposition by BTM females, we counted egg clutches on every branch of every box tree on July 17th. Once eggs were counted, we moved box trees to another greenhouse. We installed box trees in plastic saucers. We interspaced plants and filled saucers with a few centimeters of water (renewed regularly) to prevent larvae from moving from one potted plant to another.

## 2.4 BTM growth rate

Fifteen days later (July 31st), we counted larvae on every plant and haphazardly collected five L3 BTM larvae per box tree. We kept them in Petri dishes without food for 24h and weighted them to the closest 10 µg. In some Petri dishes, we observed cases of cannibalism such that in some instances we could only weight two larvae. We therefore calculated the average weight of a L3 larva, dividing the total mass by the number of larvae. Because we did not record the day every single egg hatched, we could not quantify the number of days caterpillars could feed and therefore simply analysed the average weight of a L3 larva.
136

137

Larvae were allowed to complete their development on the potted box trees. After every larvae pupated, we counted the number of chrysalis per box tree and weighted them to the closest 10 µg.

138

139

140

141

142

At this stage of the experiment, box trees that had hosted BTM were close to 100% defoliated so that it is possible that some larvae ran out of food before they pupated. In addition, we noticed that the number of chrysalis in 32 control plants (out of 60, i.e. 53%) was greater than the number of larvae (and only in 1 previously attacked plant) suggesting that in spite of our precautions some larvae could have moved from attacked to control plots (Table 1). We therefore decided not to analyze data on chrysalis.

143

## 2.5 Analyses

144

All analyses were ran in R using libraries *nlme* and *car* (Fox et al., 2016; Team, 2018; Pinheiro et al., 2020).

145

146

147

148

149

We first looked for spatial patterns in female BTM oviposition. We ran a generalized least square model (GLS) testing the effect of *x* and *y* coordinates on the number of clutches per plant (*log*-transformed) from which we explored the associated variogram using the functions *gls* and *Variogram* in the *nlme* library. There was evidence that oviposition was spatially structured, with strong spatial autocorrelation between 1 and 3m (Figure S1).

150

151

152

153

154

155

156

We tested the effect of prior herbivory on female BTM oviposition while controlling for spatial non-independence using a GLS. We had no particular hypothesis regarding the shape of the spatial correlation structure. We therefore ran separate models with different spatial correlation structures (namely, exponential, Gaussian, spherical, linear and rational quadratic), as well as a model with no correlation structure, and compared them based on their AIC (Zuur, 2009). For each model, we computed the ΔAIC (i.e., Δᵢ) as the difference between the AIC of each model *i* and that of the model with the lowest AIC (Burnham & Anderson, 2002). We report and interpret the results of the model with the lowest AIC (see *Results*).

157

158

159

We then tested the effect of prior herbivory on BTM performance using ordinary least square models, with the mean weight of five L3 larvae (*log*-transformed) as a response variable, the herbivory treatment (non-attacked *vs* attacked) as a two-levels factor and the number of egg clutches as a covariate.

160

## 3 Results

161

162

We counted a total of 818 egg clutches and 593 larvae. At individual box tree level, the number of egg clutches varied from 0 to 25 (mean ± SD: 6.76 ± 5.11, **Figure 2**).

163

164

165

166

When modelling the effect of prior herbivory on the number of egg clutches, the best model (i.e., model 6 with Δᵢ = 0, **Table 2**) was the model with a rational quadratic spatial correlation. It was competing with two other models with Δᵢ < 2 (**Table 2**). The Δᵢ of the model with no correlation structure was > 13, confirming that accounting for spatial autocorrelation among plants improved model fit.

167

168

Prior herbivory had no significant effect on the number of egg clutches per plant (model 6: χ² = 2.91, *P* = 0.088, **Figure 3A**). Competing models 2 and 3 provided the same conclusion.

169

170

The weight of BTM larvae varied from 6 to 54 mg (mean ± SD: 20 ± 9 mg). BTM larval weight was lower on box trees that had been previously defoliated (**Table 3**, **Figure 3B**). There was a significant, negative

<table><caption>Table 1: Repartition of egg clutches, larvae and chrysalis across box trees with or without prior herbivory. Numbers correspond to mean (± sd) and total number of egg clutches, larvae or chrysalis (n).</caption><thead><tr><td>Response variable</td><td>Control</td><td>Herbivory treatment</td></tr></thead><tbody><tr><td>Egg clutches</td><td>6.1 (4.87), n = 372</td><td>7.43 (5.3), n = 446</td></tr><tr><td>Larvae</td><td>4.84 (0.61), n = 295</td><td>4.97 (0.18), n = 298</td></tr><tr><td>Chrysalis</td><td>6.8 (5.78), n = 415</td><td>1.85 (1.79), n = 111</td></tr></tbody></table>
<table><caption>Table 2: Summary of AIC of GLS models testing the effect of prior herbivory on the number of egg clutches with different spatial correlation structures.</caption><thead><tr><th>Model</th><th>Correlation structure</th><th>df</th><th>AIC</th><th>Delta</th></tr></thead><tbody><tr><td>Model 1</td><td>None</td><td>3</td><td>262.5</td><td>13.1</td></tr><tr><td>Model 2</td><td>Exponential</td><td>5</td><td>249.8</td><td>0.4</td></tr><tr><td>Model 3</td><td>Gaussian</td><td>5</td><td>250.2</td><td>0.8</td></tr><tr><td>Model 4</td><td>Spherical</td><td>5</td><td>250.9</td><td>1.5</td></tr><tr><td>Model 5</td><td>Linear</td><td>5</td><td>255.1</td><td>5.7</td></tr><tr><td>Model 6</td><td>Rational quadratic</td><td>5</td><td>249.4</td><td>0.0</td></tr></tbody></table>

relationship between larval weight and the number of egg clutches on a box tree (Table 3, Figure 3B), suggesting intraspecific competition for food. There was no significant interaction between the herbivory treatment and the number of egg clutches, indicating that intraspecific competition was independent of prior herbivory (Table 3). The model explained 29 % variability in larval weight.

<figure><img src="image_4.png" /><figcaption>Figure 3: Effects of prior herbivory and conspecific density on (A) the number of egg clutches and (B) L3 larva weight. In A, grey dots represent raw data. Black dots and vertical bars represent raw means (+/- SE). In B, dots represent raw data. Black and grey curves represent model predictions for control and herbivory treatments, respectively.</figcaption></figure>

# 4 Discussion

Our findings reveal that early season herbivory reduces the performance of conspecific individuals that subsequently attack the same host plant later in the plant growing season, and that this time-lagged intraspecific competition results from a mismatch between female oviposition preference and the performance of its offspring.

**Prior herbivory had no effect BTM oviposition choice.** Possible explanations are that prior herbivory had no effect on box tree characteristics, or that female BTM were indifferent to them.
<table><caption>Table 3: Summary of models testing the effect of prior herbivory and initial egg clutch density on BTM larval weight</caption><thead><tr><td>Predictor</td><td>df</td><td>Estimate (SE)</td><td>F-value</td><td>P-value</td></tr></thead><tbody><tr><td>Number of egg clutches</td><td>1, 117</td><td>-0.03 (0.01)</td><td>20.20</td><td>&lt; 0.001</td></tr><tr><td>Herbivory</td><td>1, 117</td><td>-0.34 (0.1)</td><td>20.30</td><td>&lt; 0.001</td></tr><tr><td>Eggs x Herbivory</td><td>1, 117</td><td>0.01 (0.01)</td><td>0.73</td><td>0.396</td></tr></tbody></table>

The first explanation seems unlikely as numerous studies have clearly established that insect herbivory induces changes in plant physical and chemical traits, which have profound consequences on herbivores or herbivory on the same host plant latter in the season (Wise & Weinberg, 2002; Poelman et al., 2008; Stam et al., 2014; Abdala-Roberts et al., 2019; but see Visakorpi et al., 2019). For instance, Barnes and Murphy (2018) recently observed that the number of eggs laid by western tent caterpillar (*Malacosoma californicum*) females was much lower on chokecherry trees (*Prunus virginiana*) that have been defoliated by conspecific caterpillars earlier in the season, as a likely result of induced increase in leaf toughness. In our case, it is also possible that induced defense reactions were delayed in box trees, or that they were already relaxed when we released BTM moths three weeks after the herbivory treatment (Karban, 2011), which remains to be evaluated.

We cannot dismiss the second explanation that BTM females were indifferent to box tree cues related to earlier herbivory. This may be particularly true in species whose females individually lay several hundred eggs, thus corresponding to a within-generation bet-hedging strategy (Root & Kareiva, 1984; Hopper, 1999). Consistently, Leuthardt and Baur (2013) observed that BTM females evenly distributed egg clutches among leaves and branches, and that oviposition preference was not dictated by the size of the leaves. Assuming that this behavior is reproducible, the close distance between box-trees that we used in the present experiment (40 cm) could explain the lack of effect of initial defoliation on BTM oviposition behavior. In addition, Leuthardt et al. (2013) showed that BTM larvae are able to store or metabolise highly toxic alkaloid present in box tree leaves. Last, BTM larvae proved to be unable to distinguish between box tree leaves infected or not by the box rust *Puccinia buxi*, while their growth is reduced in the presence of the pathogenic fungus (Baur et al., 2019). Altogether, these results suggest that BTM female moths are not influenced by the amount of intact leaves and probably not either by their chemical quality when choosing the host plant, perhaps because of their strong ability to develop on toxic plants.

**Prior box tree defoliation by the spring generation of BTM larvae reduced the growth of the next generation.** Two alternative, non-mutually exclusive mechanisms can explain this pattern. First, the reduced performance of individuals of the second generation can have been trait-mediated and have resulted from induced plant defenses. This explanation is in line with studies that have documented in several plant species reduced herbivore performance and changes in plant-associated herbivore communities linked to induced defenses after prior herbivory (Nykänen & Koricheva, 2004; Karban, 2011; Stam et al., 2014). In the case of multivoltine species, negative relationship between prior herbivory and subsequent larva growth rate would indicate intraspecific plant-mediated cross-generation competition between cohorts of herbivores separated in time (Barnes & Murphy, 2018), which could influence herbivore population dynamics and distribution across host individuals. However, this explanation is partially conflicting with previous observations that BTM larva growth rate did not differ significantly among box-tree varieties, suggesting broad tolerance to variability in host traits (Leuthardt et al., 2013). Alternatively, reduced performance on previously defoliated plants may partly result from food shortage and increased exploitative competition among larvae of the same cohort. Although free living mandibulate herbivores were described to be less sensitive to competition (Denno et al., 1995), the effect of food shortage may have been exacerbated by the small size of box trees and interference competition, for instance through cannibalism (Kaygin & Taşdeler, 2019) (Schillé and Kadiri, *personal observation*).

Herbivore feeding behavior is an important determinant of herbivore adaptive response to plant defenses (Karban, 2011; Weeraddana & Evenden, 2019). Yet, in our case, larvae were not allowed to move freely and leave the potted tree to find a more suitable host, or more generally escape competition. It is therefore possible that our experimental setup overestimates the effect of intraspecific competition. Whether this
finding is relevant to real world interactions remains to be tested.

**We detected a negative relationship between the number of egg clutches laid by BTM female moths and the subsequent growth of BTM larvae.** This suggests the existence of intraspecific competition for food with the same cohort. Such competition has already been reported, particularly in leaf-miners (Bultman & Faeth, 1986; Faeth, 1992), which are endophagous insect herbivores whose inability to move across leaves makes them particularly sensitive to the choice of oviposition sites by gravid female. In our study, we prevented larvae from moving from one plant to another and noticed that some box trees were completely defoliated by the end of the experiment. Although we did not record this information, it is very likely that larvae first ran out of food in plants on which several egg clutches were laid. We are however unable to determine whether the observed intraspecific competition in this cohort was determined by food shortage, or by herbivore-induced changes in resource quality, or both.

# 5 Conclusion

Our greenhouse experiment provides evidence for negative interaction across and within BTM generation, which are independent of BTM female choice for oviposition site. Such interactions may have consequences on BTM population dynamics and damage on box-trees. On the one hand, the slow-growth-high-mortality hypothesis states that any plant trait reducing the growth rate of herbivores can be seen as a resistance trait, because slow-growing herbivores are longer exposed to their enemies (Benrey & Denno, 1997; Coley et al., 2006; Uesugi, 2015). It is therefore possible that a stronger top-down control can be exerted by generalist enemies on BTM larvae feeding on previously defoliated hosts which could reduce damage on box-trees. On the other hand, if herbivores take a longer time to complete development, they may be more damaging to plants, in particular to plants with low nutritional quality as a result of compensatory feeding (Simpson & Simpson, 1990; Milanovic et al., 2014). The consequences of time-lagged intraspecific competition on the spread of and damage by BTM remain however to be investigated in the field. Particular efforts should be dedicated to the identification of host traits controlling the performance of BTM larvae and the interaction between these traits and the higher trophic level.

# 6 Acknowledgements

We thank Alex Stemmelen, and Yannick Mellerin for their help in BTM rearing and data collection. This research was founded by the HOMED project, which received funding from the European Union's Horizon 2020 research and innovation program under grant agreement No. 771271.

# 7 Data accessibility

Raw data as well as codes of statistic analysis are available in supplementary material and on the INRA dataverse: Castagneyrol, Bastien; van Halder, Inge; Kadiri, Yasmine; Schillé, Laura; Jactel, Hervé, 2020, "Raw data for the paper 'Host-mediated, cross-generational intraspecific competition in a multivoltine herbivore species", https://doi.org/10.15454/KMUX39, Portail Data INRAE, V1

# 8 References

Abdala-Roberts L, Reyes-Hernández M, Quijano-Medina T, Moreira X, Francisco M, Angulo DF, Parra-Tabla V, Virgen A & Rojas JC (2019) Effects of amount and recurrence of leaf herbivory on the induction of direct
and indirect defences in wild cotton. Plant Biology 21:1063-1071.

Agrawal A (1999) Induced responses to herbivory in wild radish: Effects on several herbivores and plant fitness. Ecology 80:1713-1723.

Alkan Akıncı H & Kurdoğlu O (2019) Damage Level of Cydalima perspectalis (Lepidoptera: Crambidae) on Naturally Growing and Ornamental Box Populations in Artvin, Turkey. Kastamonu Üniversitesi Orman Fakültesi Dergisi.

Averill AL & Prokopy RJ (1987) Intraspecific Competition in the Tephritid Fruit Fly Rhagoletis Pomonella. Ecology 68:878-886.

Barnes EE & Murphy SM (2018) Time-lagged intraspecific competition in temporally separated cohorts of a generalist insect. Oecologia 186:711-718.

Baur B, Jung J & Rusterholz H-P (2019) Defoliation of wild native box trees (Buxus sempervirens): Does box rust (Puccinia buxi) infection influence herbivory, survival and growth of the invasive Cydalima perspectalis? Journal of Applied Entomology 143:766-775.

Benrey B & Denno RF (1997) The slow-growth-high-mortality hypothesis: A test using the cabbage butterfly. Ecology 78:987-999.

Bergamini LL & Almeida-Neto M (2015) Female Preference and Offspring Performance in the Seed Beetle Gibbobruchus bergamini Manfio & Ribeiro-Costa (Coleoptera: Chrysomelidae): A Multi-Scale Comparison. Neotropical Entomology 44:328-337.

Blenn B, Bandoly M, Küffner A, Otte T, Geiselhardt S, Fatouros NE & Hilker M (2012) Insect Egg Deposition Induces Indirect Defense and Epicuticular Wax Changes in Arabidopsis thaliana. Journal of Chemical Ecology 38:882-892.

Bultman TL & Faeth SH (1986) Experimental Evidence for Intraspecific Competition in a Lepidopteran Leaf Miner. Ecology 67:442-448.

Burnham KP & Anderson DR (2002) Model selection and multimodel inference: a practical information-theoretic approach. Springer, New York.

Coley PD, Bateman ML & Kursar TA (2006) The effects of plant quality on caterpillar growth and defense against natural enemies. Oikos 115:219-228.

De Moraes CM, Mescher MC & Tumlinson JH (2001) Caterpillar-induced nocturnal plant volatiles repel conspecific females. Nature 410:577-580.

Denno RF, McClure MS & Ott JR (1995) Interspecific Interactions in Phytophagous Insects: Competition Reexamined and Resurrected. Annual Review of Entomology 40:297-331.

Faeth SH (1986) Indirect Interactions Between Temporally Separated Herbivores Mediated by the Host Plant. Ecology 67:479-494.

Faeth SH (1992) Interspecific and Intraspecific Interactions Via Plant Responses to Folivory: An Experimental Field Test. Ecology 73:1802-1813.

Fatouros NE, Lucas-Barbosa D, Weldegergis BT, Pashalidou FG, Loon JJA van, Dicke M, Harvey JA, Gols R & Huigens ME (2012) Plant Volatiles Induced by Herbivore Egg Deposition Affect Insects of Different Trophic Levels. PLOS ONE 7:e43607.

Fox J, Weisberg S, Adler D, Bates D, Baud-Bovy G, Ellison S, Firth D, Friendly M, Gorjanc G, Graves S, Heiberger R, Laboissiere R, Monette G, Murdoch D, Nilsson H, Ogle D, Ripley B, Venables W, Winsemius D, Zeileis A & R-Core (2016) Car: Companion to Applied Regression.

Gripenberg S, Mayhew PJ, Parnell M & Roslin T (2010) A meta-analysis of preference-performance relationships in phytophagous insects. Ecology Letters 13:383-393.

Hashem MY, Ahmed AAI, Mohamed SM, Sewify GH & Khalil SH (2013) Oviposition deterrent effect of
306

307

Spodoptera littoralis (Boisd.) larval frass to adult females of two major noctuid insect pests. Archives of Phytopathology and Plant Protection 46:911-916.

308

309

Hilker M & Fatouros NE (2015) Plant Responses to Insect Egg Deposition. Annual Review of Entomology 60:493-515.

310

311

Hopper KR (1999) Risk-spreading and bet-hedging in insect population biology. Annual Review of Entomology 44:535-560.

312

313

Jones TH & Finch S (1987) The effect of a chemical deterrent, released from the frass of caterpillars of the garden pebble moth, on cabbage root fly oviposition. Entomologia Experimentalis et Applicata 45:283-288.

314

315

Kaplan I & Denno RF (2007) Interspecific interactions in phytophagous insects revisited: A quantitative assessment of competition theory. Ecology Letters 10:977-994.

316

317

Karban R (2011) The ecology and evolution of induced resistance against herbivores. Functional Ecology 25:339-347.

318

319

Kaygin AT & Taşdeler C (2019) Cydalima perspectalis (Walker) (Lepidoptera: Crambidae, Spilomelinae)'in Türkiye'de Coğrafi Yayılışı, Yaşam Döngüsü Ve Zararı. Bartın Orman Fakültesi Dergisi 21:833-847.

320

321

322

Kenis M, Nacambo S, Leuthardt FLG, Domenico F di & Haye T (2013) The box tree moth, Cydalima perspectalis, in Europe: Horticultural pest or environmental disaster? Aliens: The Invasive Species Bulletin:38-41.

323

324

Leuthardt FLG & Baur B (2013) Oviposition preference and larval development of the invasive moth Cydalima perspectalis on five European box-tree varieties. Journal of Applied Entomology 137:437-444.

325

326

Leuthardt FLG, Glauser G & Baur B (2013) Composition of alkaloids in different box tree varieties and their uptake by the box tree moth Cydalima perspectalis. Chemoecology 23:203-212.

327

328

Marchand D & McNeil JN (2004) Avoidance of intraspecific competition via host modification in a grazing, fruit-eating insect. Animal Behaviour 67:397-402.

329

330

331

Martinez G, Finozzi MV, Cantero G, Soler R, Dicke M & Gonzalez A (2017) Oviposition preference but not adult feeding preference matches with offspring performance in the bronze bug Thaumastocoris peregrinus. Entomologia Experimentalis Et Applicata 163:101-111.

332

333

334

335

336

337

Matošević D, Matošević D, Croatian Forest Research Institute, Cvjetno naselje 41, HR-10450 Jastrebarsko, Croatia, Bras A, INRA, UR633 Unité de Recherche de Zoologie Forestière, 2163 Avenue de la Pomme de Pin, CS 40001 ARDON45075 ORLEANS Cedex 2, France, Lacković N, Croatian Forest Research Institute, Cvjetno naselje 41, HR-10450 Jastrebarsko, Croatia, Pernek M & Croatian Forest Research Institute, Cvjetno naselje 41, HR-10450 Jastrebarsko, Croatia (2017) Spatial Distribution, Genetic Diversity and Food Choice of Box Tree Moth (Cydalima perspectalis) in Croatia. South-east European forestry 8.

338

339

340

Milanovic S, Lazarevic J, Popovic Z, Miletic Z, Kostic M, Radulovic Z, Karadzic D & Vuleta A (2014) Preference and performance of the larvae of Lymantria dispar (Lepidoptera: Lymantriidae) on three species of European oaks. European Journal of Entomology 111:371-378.

341

342

Molnár BP, Tóth Z & Kárpáti Z (2017) Synthetic blend of larval frass volatiles repel oviposition in the invasive box tree moth, Cydalima perspectalis. Journal of Pest Science 90:873-885.

343

344

345

Moreira X, Abdala-Roberts L & Castagneyrol B (2018) Interactions between plant defence signalling pathways: Evidence from bioassays with insect herbivores and plant pathogens (M Rees, Ed. by). Journal of Ecology 106:2353-2364.

346

347

348

Moura RR, Ribeiro PVA, Pereira BG, Quero A, Carvalho RL & Oliveira DC (2017) Food, shelter or competitors? Overlapping of life stages and host plant selection in a Neotropical stink bug species. Journal of Plant Interactions 12:560-566.

349

Nykänen H & Koricheva J (2004) Damage-induced changes in woody plants and their effects on insect
350 herbivore performance: A meta-analysis. Oikos 104:247-268.

351 Pinheiro J, Bates D, DebRoy S, Sarkar D & Team RC (2020) Nlme: Linear and Nonlinear Mixed Effects Models.
352

353 Poelman EH, Broekgaarden C, Loon JJaV & Dicke M (2008) Early season herbivore differentially affects plant defence responses to subsequently colonizing herbivores and their abundance in the field. Molecular Ecology 17:3352-3365.
354
355

356 Root RB & Kareiva PM (1984) The Search for Resources by Cabbage Butterflies (Pieris Rapae): Ecological Consequences and Adaptive Significance of Markovian Movements in a Patchy Environment. Ecology 65:147-165.
357
358

359 Sato Y, Yano S, Takabayashi J & Ohsaki N (1999) *Pieris rapae*/i* (Ledidoptera : Pieridae) *females avoid oviposition on* <i>*Rorippa indica* plants infested by conspecific larvae. Applied Entomology and Zoology 34:333-337.
360
361

362 Shiojiri K & Takabayashi J (2003) Effects of specialist parasitoids on oviposition preference of phytophagous insects: Encounter-dilution effects in a tritrophic interaction. Ecological Entomology 28:573-578.
363

364 Simpson SJ & Simpson C (1990) The Mechanisms of Nutritional Compensation by Phytophagous Insects. Insect-Plant Interactions (1990) : Volume II. CRC Press,
365

366 Stam JM, Kroes A, Li Y, Gols R, Loon JJ van, Poelman EH & Dicke M (2014) Plant Interactions with Multiple Insect Herbivores: From Community to Genes. Annual Review of Plant Biology 65:689-713.
367

368 Team RC (2018) R: A language and environment for statistical computing.

369 Uesugi A (2015) The slow-growth high-mortality hypothesis: Direct experimental support in a leafmining fly. Ecological Entomology 40:221-228.
370

371 Visakorpi K, Riutta T, Martínez-Bauer AE, Salminen J-P & Gripenberg S (2019) Insect community structure covaries with host plant chemistry but is not affected by prior herbivory. Ecology 100:e02739.

373 Wan H, Haye T, Kenis M, Nacambo S, Xu H, Zhang F & Li H (2014) Biology and natural enemies of *Cydalima perspectalis* in Asia: Is there biological control potential in Europe? Journal of Applied Entomology 138:715-722.
374
375

376 Weeraddana CDS & Evenden ML (2019) Herbivore-induced plants do not affect oviposition but do affect fitness of subsequent herbivores on canola. Entomologia Experimentalis et Applicata 167:341-349.
377

378 Wise MJ & Weinberg AM (2002) Prior flea beetle herbivory affects oviposition preference and larval performance of a potato beetle on their shared host plant. Ecological Entomology 27:115-122.
379

380 Wratten SD, Edwards PJ & Winder L (1988) Insect herbivory in relation to dynamic changes in host plant quality. Biological Journal of the Linnean Society 35:339-350.
381

382 Zuur AF (2009) Mixed effects models and extensions in ecology with R. Springer, New York; London.

# 9 Appendix

383

## 9.1 Supplementary figure

384

**Figure S1** - Semivariogram of the number of egg clutches as a function of distance among box trees.
385
<figure><img src="image_5.png" /></figure>

386

387

## 9.2 Supplementary table containing raw data

388

389

390

391

392

**Table S1** - Raw data used in the present manuscript: x and y are the position of each box tree in the green house; *Treatment* is the prior herbivory treatment; *Clutch.number* is the total number of egg clutches counted on a given box tree; *N.L3* is the number of retrieved L3 larvae, *L3.mean* is the mean weight of a L3 larvae (g); *N.chrysalids* is the number of retroved chrysalids; *Chrysalid.mean* is the mean weight of a chrysalid.
<table><thead><tr><th>x</th><th>y</th><th>Treatment</th><th>Clutch.number</th><th>N.L3</th><th>L3.mean</th><th>N.chrysalids</th><th>Chrysalid.mean</th></tr></thead><tbody><tr><td>1</td><td>1</td><td>Attacked</td><td>22</td><td>5</td><td>0.0221740</td><td>0</td><td>NaN</td></tr><tr><td>2</td><td>1</td><td>Attacked</td><td>8</td><td>5</td><td>0.0183980</td><td>0</td><td>NaN</td></tr><tr><td>3</td><td>1</td><td>Attacked</td><td>12</td><td>5</td><td>0.0187360</td><td>1</td><td>0.1020100</td></tr><tr><td>4</td><td>1</td><td>Non attacked</td><td>7</td><td>5</td><td>0.0142200</td><td>6</td><td>0.1612240</td></tr><tr><td>5</td><td>1</td><td>Attacked</td><td>6</td><td>5</td><td>0.0146140</td><td>0</td><td>NaN</td></tr><tr><td>6</td><td>1</td><td>Attacked</td><td>10</td><td>5</td><td>0.0165620</td><td>2</td><td>0.1101750</td></tr><tr><td>7</td><td>1</td><td>Non attacked</td><td>19</td><td>5</td><td>0.0140740</td><td>6</td><td>0.1295600</td></tr><tr><td>8</td><td>1</td><td>Attacked</td><td>20</td><td>5</td><td>0.0110140</td><td>1</td><td>0.0961900</td></tr><tr><td>9</td><td>1</td><td>Attacked</td><td>4</td><td>5</td><td>0.0132300</td><td>1</td><td>0.1438500</td></tr><tr><td>10</td><td>1</td><td>Attacked</td><td>25</td><td>5</td><td>0.0057520</td><td>1</td><td>0.0891900</td></tr><tr><td>11</td><td>1</td><td>Non attacked</td><td>14</td><td>5</td><td>0.0252560</td><td>4</td><td>0.0800775</td></tr><tr><td>1</td><td>2</td><td>Attacked</td><td>12</td><td>5</td><td>0.0226500</td><td>2</td><td>0.2062350</td></tr><tr><td>2</td><td>2</td><td>Attacked</td><td>10</td><td>5</td><td>0.0162200</td><td>1</td><td>0.0524100</td></tr><tr><td>3</td><td>2</td><td>Attacked</td><td>9</td><td>5</td><td>0.0200760</td><td>0</td><td>NaN</td></tr><tr><td>4</td><td>2</td><td>Attacked</td><td>11</td><td>5</td><td>0.0211200</td><td>5</td><td>0.1465000</td></tr><tr><td>5</td><td>2</td><td>Non attacked</td><td>9</td><td>5</td><td>0.0160880</td><td>2</td><td>0.1455000</td></tr><tr><td>6</td><td>2</td><td>Non attacked</td><td>11</td><td>4</td><td>0.0332225</td><td>11</td><td>0.1486660</td></tr><tr><td>7</td><td>2</td><td>Attacked</td><td>5</td><td>5</td><td>0.0112560</td><td>0</td><td>NaN</td></tr><tr><td>8</td><td>2</td><td>Non attacked</td><td>4</td><td>5</td><td>0.0192900</td><td>10</td><td>0.1718880</td></tr><tr><td>9</td><td>2</td><td>Attacked</td><td>4</td><td>5</td><td>0.0161760</td><td>1</td><td>0.1338800</td></tr><tr><td>10</td><td>2</td><td>Attacked</td><td>4</td><td>5</td><td>0.0173680</td><td>1</td><td>0.1706800</td></tr><tr><td>11</td><td>2</td><td>Non attacked</td><td>18</td><td>5</td><td>0.0164180</td><td>1</td><td>0.1142100</td></tr><tr><td>1</td><td>3</td><td>Attacked</td><td>14</td><td>5</td><td>0.0159000</td><td>4</td><td>0.1686525</td></tr><tr><td>2</td><td>3</td><td>Non attacked</td><td>3</td><td>5</td><td>0.0193180</td><td>8</td><td>0.1842200</td></tr><tr><td>3</td><td>3</td><td>Non attacked</td><td>5</td><td>5</td><td>0.0277660</td><td>10</td><td>0.1413480</td></tr><tr><td>4</td><td>3</td><td>Attacked</td><td>5</td><td>5</td><td>0.0159420</td><td>2</td><td>0.1380100</td></tr><tr><td>5</td><td>3</td><td>Attacked</td><td>6</td><td>5</td><td>0.0121100</td><td>1</td><td>0.1319100</td></tr><tr><td>6</td><td>3</td><td>Non attacked</td><td>8</td><td>5</td><td>0.0535020</td><td>9</td><td>0.1464700</td></tr><tr><td>7</td><td>3</td><td>Non attacked</td><td>1</td><td>5</td><td>0.0197740</td><td>11</td><td>0.1815320</td></tr><tr><td>8</td><td>3</td><td>Non attacked</td><td>2</td><td>5</td><td>0.0334440</td><td>9</td><td>0.2104500</td></tr><tr><td>9</td><td>3</td><td>Non attacked</td><td>2</td><td>5</td><td>0.0144920</td><td>2</td><td>0.1980650</td></tr><tr><td>10</td><td>3</td><td>Non attacked</td><td>8</td><td>5</td><td>0.0188620</td><td>7</td><td>0.1529100</td></tr><tr><td>11</td><td>3</td><td>Attacked</td><td>11</td><td>5</td><td>0.0101960</td><td>1</td><td>0.0836300</td></tr><tr><td>1</td><td>4</td><td>Attacked</td><td>2</td><td>5</td><td>0.0111600</td><td>2</td><td>0.1224050</td></tr><tr><td>2</td><td>4</td><td>Non attacked</td><td>21</td><td>5</td><td>0.0127880</td><td>2</td><td>0.1022250</td></tr><tr><td>3</td><td>4</td><td>Attacked</td><td>11</td><td>5</td><td>0.0157420</td><td>0</td><td>NaN</td></tr><tr><td>4</td><td>4</td><td>Attacked</td><td>11</td><td>5</td><td>0.0158140</td><td>4</td><td>0.1557575</td></tr><tr><td>5</td><td>4</td><td>Non attacked</td><td>2</td><td>5</td><td>0.0171240</td><td>1</td><td>0.1575800</td></tr><tr><td>6</td><td>4</td><td>Attacked</td><td>2</td><td>5</td><td>0.0238660</td><td>2</td><td>0.1728600</td></tr><tr><td>7</td><td>4</td><td>Non attacked</td><td>11</td><td>5</td><td>0.0151460</td><td>0</td><td>NaN</td></tr><tr><td>8</td><td>4</td><td>Attacked</td><td>5</td><td>5</td><td>0.0187260</td><td>2</td><td>0.1527050</td></tr><tr><td>9</td><td>4</td><td>Non attacked</td><td>5</td><td>5</td><td>0.0256880</td><td>5</td><td>0.1158560</td></tr><tr><td>10</td><td>4</td><td>Non attacked</td><td>5</td><td>5</td><td>0.0171440</td><td>3</td><td>0.1927033</td></tr><tr><td>11</td><td>4</td><td>Attacked</td><td>8</td><td>5</td><td>0.0181900</td><td>0</td><td>NaN</td></tr><tr><td>1</td><td>5</td><td>Non attacked</td><td>4</td><td>5</td><td>0.0185720</td><td>3</td><td>0.1905400</td></tr><tr><td>2</td><td>5</td><td>Non attacked</td><td>3</td><td>5</td><td>0.0363840</td><td>20</td><td>0.1862420</td></tr><tr><td>3</td><td>5</td><td>Non attacked</td><td>4</td><td>5</td><td>0.0224060</td><td>8</td><td>0.1504320</td></tr><tr><td>4</td><td>5</td><td>Non attacked</td><td>4</td><td>5</td><td>0.0291180</td><td>9</td><td>0.1339320</td></tr><tr><td>5</td><td>5</td><td>Attacked</td><td>1</td><td>5</td><td>0.0201820</td><td>1</td><td>0.1914500</td></tr><tr><td>6</td><td>5</td><td>Non attacked</td><td>2</td><td>5</td><td>0.0313100</td><td>2</td><td>0.1725900</td></tr><tr><td>7</td><td>5</td><td>Attacked</td><td>1</td><td>5</td><td>0.0148320</td><td>3</td><td>0.1752800</td></tr><tr><td>8</td><td>5</td><td>Attacked</td><td>2</td><td>5</td><td>0.0176160</td><td>1</td><td>0.0853400</td></tr><tr><td>9</td><td>5</td><td>Non attacked</td><td>15</td><td>5</td><td>0.0130960</td><td>1</td><td>0.1001600</td></tr><tr><td>10</td><td>5</td><td>Attacked</td><td>10</td><td>13</td><td>0.0171925</td><td>1</td><td>0.1453700</td></tr><tr><td>11</td><td>5</td><td>Non attacked</td><td>7</td><td>5</td><td>0.0128840</td><td>2</td><td>0.1279200</td></tr><tr><td>1</td><td>6</td><td>Attacked</td><td>4</td><td>5</td><td>0.0158160</td><td>2</td><td>0.1774000</td></tr><tr><td>2</td><td>6</td><td>Non attacked</td><td>4</td><td>5</td><td>0.0225620</td><td>11</td><td>0.1544600</td></tr></tbody></table>
9.3 All code for this report

library(tidyverse)
library(knitr)
library(kableExtra)
library(nlme)
library(car)
library(citr)
library(here)

wd = here()

my.ggplot <- function() {
  theme_bw() + theme(legend.key = element-blank())
}

knitr::opts_chunk$set(echo= F, warning= F, message = F, results = "hide",
  fig.width=4, fig height=4, dpi= 100, fig.pos = "H",
  fig.path = paste0(wd, '/Figures/'))

d = read.csv(paste0(wd, '/Data/BTM_data.csv'), header = T)

str(d)

d =
  d %>% mutate(L3.mean = Weight.L3 / N.L3) %>%
  mutate(Treatment = factor(Treatment, levels = c("Non attacked", "Attacked")))
knitr::includegraphics(paste0(wd, '/Figures/Figure 1.png'))

d %>%
  ggplot(aes(x, y, shape = Treatment, fill = log1p(Clutch.number))) +
  # geomRect(aes(xmin = 1.5, ymin = 1.5, xmax = 10.5, ymax = 10.5), fill = 'grey90') +
  geom_point(size = 6) +
  scaleShape_manual(values = c(21, 24)) +
  my.ggplot() +
  labs(x = "", y = "") +
  scale_fillgradientn(colours = c('white', 'grey', 'black'), values = c(0,0.6,1), name = 'No. egg clut')

d %>%
  select(Treatment, Clutch.number, N.L3, N.chyalids) %>%
  gather(Resp, Val, 2:4) %>%
  group_by(Treatment, Resp) %>%
  summarise(N = sum(Val), M = round(mean(Val),2), SD = round(sd(Val),2)) %>%
  mutate(Val = paste(M, ' (', SD, ')', ', n = ', N, sep =')) %>%
  select(- N, - M, - SD) %>%
  mutate(Resp = factor(Resp, levels = c('Clutch.number', 'N.L3', 'N.chyalids'), labels = c('Egg clut'))
  spread(Treatment, Val) %>%
  kable(col.names = c('Response variable', 'Control', 'Herbivory treatment'),
    caption = "Repartition of egg clutches, larvae and chrysalis across box trees with or without p")
d.center = droplevels(d[d$x > 1 & d$x < 11 & d$y > 1 & d$y < 11,])
m0 = gls(log1p(Clutch.number) ~ Treatment, data = d, na.action = "na.omit")
m1a = gls(log1p(Clutch.number) ~ Treatment, correlation = corExp(form = ~x + y, nugget = TRUE), data =
m1b = gls(log1p(Clutch.number) ~ Treatment, correlation = corGaus(form = ~x + y, nugget = TRUE), data =
m1c = gls(log1p(Clutch.number) ~ Treatment, correlation = corSpher(form = ~x + y, nugget = TRUE), data =
```r
m1d = gls(log1p(Clutch.number) ~ Treatment, correlation = corLin(form = ~x + y, nugget = TRUE), data = d)
m1e = gls(log1p(Clutch.number) ~ Treatment, correlation = corRatio(form = ~x + y, nugget = TRUE), data = d)

Table_AIC = AIC(m0, m1a, m1b, m1c, m1d, m1e)
Table_AIC$AIC = round(Table_AIC$AIC, 1)
Table_AIC$Delta = Table_AIC$AIC - min(Table_AIC$AIC)
# Table_AIC %>>% kable() %>>% kableExtra::kable_styling()

# plot_resid = function(model) {
#   df = data.frame(Residuals = residuals(model),
#                    Fitted = fitted(model))
#
#   A = df %>% ggplot(aes(Fitted, Residuals)) +
#     my.ggplot() +
#     geom_point() +
#     geom.smooth(method = "lm", se = F) +
#     geom_hline(yintercept = 0)
#
#   B = df %>% ggplot(aes(Residuals)) + my.ggplot() + geom_histogram()
#
#   cowplot::plot_grid(A, B)
# }
#
# plot_resid(m1e)
# Alternative approach fitting *x* and *y* position in the greenhouse together with `treatment` and `N. attacked`
#
# m = MASS::glm.nb(Clutch.number ~ Treatment * N.attacked, data = d.center)
# Anova(m)
#
# #
# # var.resid = Variogram(residuals(m), dist(d.center %>% select(x, y)))
# # var.resid %>
# # ggplot(aes(dist, variog)) +
# # my.ggplot() +
# # # geom_point(size = 3) +
# # geom.smooth(se = F) +
# # labs(x = "Distance (m)", y = "Semivariogram")
plot.resid = function(m) {
  df = data.frame(f = fitted(m), r = residuals(m))
  A = df %>%
    ggplot(aes(f, r)) + my.ggplot() + geom_point() + geom.smooth(method = "lm", se = F) + geom_hline(yintercept = 0)
  B = df %>%
    ggplot(aes(r)) + my.ggplot() + geom_histogram()
  cowplot::plot_grid(A,B)
}

m_larvae = lm(log(L3.mean) ~ Clutch.number * Treatment, d)

# plot.resid(m_larvae)

d =
  d %>
  mutate(Chrysalid.mean = Weight.chrysalids / N weighted.chrysalids)
```
```r
m_chrys = lm(log(Chrysalid.mean) ~ Clutch.number * Treatment, d)
# plot.resid(m2)
Table_AIC %>%
  mutate(Model = paste('Model', 1:6),
        'Correlation structure' = c('None', 'Exponential', 'Gaussian', 'Spherical', 'Linear', 'Rational'
        select(Model, `Correlation structure`, everything()) %>%
  kable(caption = "Summary of AIC of GLS models testing the effect of prior herbivory on the number of
  Anova(m1e)
```

```r
Fig_3A =
  d %>%
  ggplot(aes(Treatment, Clutch.number)) +
  my.ggplot() +
  geom_point(position = position_jitter(0.1), colour = "grey80") +
  stat_summary(size = 0.6) +
  labs(x = "Prior herbivory", y = "Number of egg clutches") +
  annotate(geom = 'text', x = 1:2, y = 26, label = paste("n =", c(61, 60)))
res_larvae = Anova(m_larvae)
n = expand.grid(Treatment = levels(d$Treatment), Clutch.number = seq(0, 25))
p = predict.update(m_larvae, ~.- Clutch.number:Treatment), newdata = n)
n$Fit = 1000 * exp(p)
```

```r
Fig_3B =
  d %>%
  ggplot(aes(Clutch.number, 1000 * L3.mean, colour = Treatment)) +
  my.ggplot() +
  geom_point(size = 2) +
  scale_colour_manual(values = c("grey25", "grey70")) +
  labs(x = "Number of egg clutches",
       y = expression("Mean larval weight" %+-% "SE (mg)")) +
  geom_line(data = n, aes(Clutch.number, Fit), size = 1.5) +
  theme(legend(position = c(0.8, 0.85))
)
r = with(d, cor.test(Chrysalid.mean, L3.mean))
```

```r
cowplot::plot_grid(
  Fig_3A + labs(title = 'Eggs'),
  Fig_3B + labs(title = 'Larvae'),
  ncol = 2,
  labels = c('A', 'B')
)
X = c("Number of egg clutches", "Herbivory", "Eggs x Herbivory")
Fval = function(x) {round(x[,3], 2)}
Pval = function(x) {ifelse(x[,4] < 0.001, '< 0.001', round(x[,4], 3))}
df = rep("1, 117", 3)
b = round(summary(m_larvae)$coefficients[-1,1], 2)
b_se = round(summary(m_larvae)$coefficients[-1,2], 2)
Estimate = paste(b, ' (' , b_se, ')', sep = '')
```

```r
data.frame(#Response = c('Larvae', '', ''),
  Predictor = X,
  df = df,
  Estimate = Estimate,
  `F-value` = Fval(res_larvae)[-4],
```
```r
`P-value` = Pval(res_larvae)[-4]) %>%
kable(caption = "Summary of models testing the effect of prior herbivory and initial egg clutch density on the number of larvae in each treatment",
       col.names = c("Predictor", "df", "Estimate (SE)", "F-value", "P-value"), escape = T, digit = 2)
m0 = gls(log1p(Clutch.number) ~ x + y, data = d, na.action = "na.omit")
variog0 <- Variogram(m0, form = ~x + y, resType = "pearson", nugget = T)
variog0 %>%
  ggplot(aes(0.4*dist, variog)) +
  my.ggplot() +
  geom_point(size = 3) +
  geom.smooth(se = F) +
  labs(x = "Distance (m)", y = "Semivariogram") +
  xlim(0, 4)
d %>%
  rename(N.chrysalids = N.chrysalids) %>%
  select(x, y, Treatment, Clutch.number, N.L3, L3.mean, N.chrysalids, Chrysalid.mean) %>% kable() %>% kable
```