Introduction It is common in natural populations for individuals of one sex (usually females) to prefer certain trait values over others in their choice of mates [1–5]. Such mating preferences have long been thought to be key to speciation, because their divergence among populations will generate premating (behavioral) reproductive isolation. Consistent with this, mating preferences have been observed to vary among populations and closely related species in nature [5–10], and, in several taxa, evidence suggests that the resulting behavioral isolation has been instrumental in initiating speciation [11]. According to various speciation models, divergence among populations in mating preferences can occur in two main ways [12]. First, initial divergence in mating preferences in arbitrary directions may be caused by chance events such as unique mutations and/or the order in which they appear. Although such genetic drift is unlikely to cause substantial preference divergence on its own [11], sexual selection may subsequently amplify this initial divergence to yield a wide array of possible outcomes [13–16]. Speciation by sexual conflict is a popular example of such a model [16–18]. Second, initial divergence in mating preferences may be caused by divergent natural selection between environments, which may also in some [19–21], but not all [22] models, be subsequently amplified by sexual selection. The roles of genetic drift and divergent natural selection in the diversification of mating preferences are not well understood. A number of comparative studies implicate sexual selection in speciation in a variety of taxa [11], although comparative approaches are unable to provide direct tests of the evolutionary mechanisms responsible for the initial divergence in mating preferences. The role of divergent natural selection in the evolution of premating isolation has been tested experimentally, with results clearly demonstrating the feasibility of this mechanism under some conditions [11,12,23]. Unfortunately, how divergent selection generates premating isolation is typically not known, because the mating preferences responsible are generally not identified in such experiments. A complementary experimental approach to understanding the mechanisms responsible for the diversification of mating preferences has not been developed. Such an approach is important, because the details of signal trait and preference evolution are key to distinguishing various speciation models [11]. Here we present an evolutionary experiment designed to directly test the role of divergent selection in the diversification of mating preferences. A clear expectation of how divergent selection should affect mating preferences is provided by the classic by-product model of allopatric speciation. According to this model, reproductive isolation evolves as a side effect of divergent selection adapting populations to their different environments [12,23–25]. If differences in mating preferences are a key trait contributing to reproductive isolation, independent populations adapted to different environments should diverge in mating preferences, whereas those adapted to similar environments should express the same preference. Laboratory experiments [23,26,27] and studies in nature [12,28–30] have confirmed these predictions for the evolution of premating isolation. Here, we provide an experimental test of whether these same predictions can be verified for the evolution of female mating preferences. We tested how adaptation to two novel resource environments affected the evolution of female mating preferences in Drosophila serrata, a species in which mate choice has been investigated in a number of genetic and evolutionary experiments. D. serrata uses multiple contact pheromones, composed of nonvolatile cuticular hydrocarbons (CHCs), in both mate choice within populations [31–35] and species recognition [36,37]. Most importantly, male CHCs have been shown to respond rapidly to both natural and sexual selection [37,38], demonstrating that these signal traits readily evolve when selection is manipulated. However, how female mating preferences for male CHCs respond to divergent selection has not been determined. We do so here by deriving 12 replicate populations from a common ancestor and propagating four of them in each of three separate treatment environments: their ancestral laboratory environment (yeast food) and two novel environments (rice and corn food). We show how the novel environments affected the evolution of CHCs and female mating preferences for them using a three-stage process. First, we demonstrate that CHCs adapted to the novel environments using the classic pattern of parallel evolution. Parallel evolution provides strong evidence that divergent selection between environments is responsible for trait evolution, because other mechanisms of evolution, such as genetic drift, are unlikely to produce similar changes in independent populations in correlation with environment [39,40]. Second, we demonstrate for each population the importance of CHCs in determining male mating success by employing population-level sexual selection gradients to estimate the form and strength of female mating preferences for male CHCs. Like many signaling systems [41,42], mate choice in D. serrata depends on the collective presence of multiple traits; here we consider the nine male CHCs shown by past studies to be associated with male mating success [31–33,35] and species recognition [36,37]. Third, to deal with the complexity generated by estimating 528 separate sexual selection gradients within a single experimental design, we employ a multivariate model fitting approach that uses partial F-tests to partition the effects of linear (directional) and nonlinear (quadratic and correlational) sexual selection within and among treatment environments. A role for divergent selection in preference evolution is demonstrated by consistent changes in preferences in correlation with treatment environment. Results Adaptation of Male and Female CHCs CHCs adapted to the novel food environments, evolving in parallel in correlation with these environments. As indicated by the significant sex × treatment interaction (Table 1), the response to selection differed in males and females. CHCs also varied significantly among populations within the treatment environments (Table 1). Examination of the first canonical variate (CV) of the sex × treatment interaction (CV1, the linear combination of eight logcontrast-transformed CHCs that explains the most variance—85.2% in this case—in the sex × treatment interaction) reveals that, relative to the populations in the ancestral yeast environment, sexual dimorphism in the combination of CHCs that responded to selection tended to increase in populations adapted to rice and decrease in populations adapted to corn (Figure 1). When the sexes were analyzed separately, the treatment effect was significant in females (p = 0.018) but not in males (p = 0.153), indicating greater adaptation to the treatment environments by females than males. Sexual Selection on Male CHCs Within Populations Consistent with results from past studies [31–35], female mating preferences generated strong sexual selection on male CHCs in these populations (Table S1). Overall, linear sexual selection on the eight logcontrast CHCs was significant in each of the 12 populations (p 99%) of them. Mating vials were observed, and once intromission had been achieved between the female and one of the two males, all flies were anesthetized with CO2 and the chosen and rejected males had their CHCs extracted for subsequent GC analysis (females were discarded). CHC profiles of each male were integrated and proportional peak areas were logcontrast transformed. Characterizing sexual selection within populations Linear sexual selection on the eight male logcontrast CHCs arising from female mating preferences was analyzed separately in each population using the standard first-order polynomial regression model [55]. Although male mating success was binomially distributed in these analyses, parametric significance testing was performed in all cases using standard methods within a linear model framework, because when sample sizes are large and the probability of either outcome is equal (as in the present case), the binomial distribution provides an excellent approximation of the normal distribution. Results of bootstrap analyses from past experiments have confirmed the accuracy of this approximation [32]. Males were treated as independent replicates in these analyses; this has no discernable effect on the significance of individual selection gradients when compared with treating females as replicates (Figure S1 and S2; Protocol S1). To confirm the presence of sexual selection on male CHCs by female mating preferences in our populations, we estimated, separately for each population, the strength of linear sexual selection on the eight logcontrast CHCs for each male. Similar to past studies [31–35], multicollinearity among these logcontrast CHCs was minimal, so these values were used directly in the analysis. From these regressions, the proportion of total variation in male mating success accounted for by linear sexual selection on all eight logcontrast CHCs was given by the adjusted coefficient of determination (r 2), with significance indicated by the overall fit of the model. To evaluate the overall significance of nonlinear selection on the eight logcontrast CHCs in our populations, we first conducted a canonical rotation to place all nonlinear selection on the eight eigenvectors of the matrix of quadratic and cross-product terms (i.e., the gamma matrix) in each population, thus eliminating all cross-product terms [57]. Nonlinear sexual selection on these eight eigenvectors was then analyzed using the standard second-order polynomial regression model [55,58]. The overall significance of all nonlinear selection in each population was then evaluated using partial F-tests [35,59] that compared the fit of the models with and without the eight quadratic terms. Conducting such a rotation does not affect the amount of nonlinear selection present in each population, but does increase the likelihood of detecting its significance by reducing the number of nonlinear coefficients from 36 to eight. Variation among populations in sexual selection To determine if female mating preferences diverged among populations, we tested for variation among populations in both linear and nonlinear sexual selection on male CHCs. Among-population variation in linear sexual selection was tested using the following model: where Y is the mating success of the ith male from the bth population (b = 1 − 12). C l is the effect on male mating success of the lth male logcontrast CHC, representing linear sexual selection on this trait. Variation among populations in linear sexual selection on male logcontrast CHC peak value l would be indicated by a significant C l P b interaction. To evaluate whether linear sexual selection varied among the twelve populations, we used a single partial F-test [35,59] that compared the fit of the above model with one lacking all of the C l P b interactions. Among-population variation in nonlinear sexual selection was evaluated in an analogous manner using the following model: where C l C m is the combined effect on male mating success of the lth and mth male logcontrast CHCs, representing nonlinear selection (quadratic: l = m; correlational: l ≠ m) on these traits. Variation among populations in nonlinear sexual selection would be indicated by a significant C l C m P b interaction. To evaluate whether nonlinear selection varied among populations overall, we again used a single partial F-test [35,59] that compared the fit of this model with one lacking all of the C l C m P b interactions. By excluding from the reduced model the interactions of all nonlinear terms with population, significance of this partial F-test reflects the combined importance of among-population variation in all forms of nonlinear sexual selection. Variation among treatments in sexual selection To determine if natural selection adapting populations to their novel treatment environments caused consistent mating preference divergence, we tested for variation among treatments in both linear and nonlinear sexual selection on male CHCs. Among-treatment variation in linear sexual selection was tested using the following model: where the bth population is nested within the ath treatment environment (yeast, rice, and corn). Treatment was modeled as a fixed effect and population was modeled as a random effect nested within treatment. Variation among treatments in linear sexual selection on male logcontrast CHC peak value l would be indicated by a significant C l T a interaction. To evaluate whether linear sexual selection varied among treatments overall, we used a single partial F-test [35,59] that compared the fit of the above model with one lacking all of the C l T a interactions. Among-treatment variation in nonlinear sexual selection was evaluated in a similar manner using the following model: Variation among treatments in nonlinear sexual selection would be indicated by a significant C l C m T a interaction in this model. To evaluate whether nonlinear selection varied among treatments overall, we again used a single partial F-test [35,59] that compared the fit of this model with one lacking all of the C l C m T a interactions. The contribution of divergent selection to the among-population diversification of mating preferences was quantified using MS ratios. For linear sexual selection, the total among-population variation is represented by the MS (C l P b) from Equation 2, and the among-treatment variation by the MS (C l T a) from Equation 4. Their ratio, MS (C 1 T a) / MS (C l P b), is an estimate of the proportion of the total among-population variation in mating preferences that is grouped by treatment environment. For nonlinear sexual selection, this ratio is MS (C l C m T a) / MS (C l C m P b), obtained from Equations 5 and 3, respectively, and is an estimate of the proportion of the total among-population variation in nonlinear mating preferences that is grouped by treatment environment. Supporting Information Figure S1 Quantifying Potential Bias in the Magnitude of Selection Gradients Caused by Pseudoreplication Mean sexual selection gradients on eight logcontrast male CHCs from three geographic populations are presented. For each population, mean selection gradients were estimated from 1,000 bootstrap replicates each of two subpopulations composed of 128 males (64 chosen, 64 rejected) randomly sampled from the population of 256 males. In subpopulation A, 64 trials were randomly selected, and both the chosen and rejected males were used. In subpopulation B, a single male (chosen or rejected) was sampled from each of the 128 trials. The line is a one-to-one line. (19 KB CDR). Click here for additional data file. Figure S2 Quantifying Potential Bias in the Significance Level of Selection Gradients Caused by Pseudoreplication Mean significance levels for the sexual selection gradients on eight logcontrast male CHCs from three geographic populations estimated from 1,000 bootstrap replicates of subpopulations A and B as described in Figure S1. The line is a one-to-one line. (19 KB CDR). Click here for additional data file. Table S1 Standardized Linear and Nonlinear Sexual Selection Gradients on the Eight Male CHCs for Each of the 12 Populations (45 KB WPD). Click here for additional data file. Table S2 Media Recipes for the Three Treatment Environments (19 KB WPD). Click here for additional data file. Protocol S1 Pseudoreplication and Multiple-Choice Mating Trials (24 KB WPD). Click here for additional data file.