Differential speciation rates, colonization time and niche conservatism affect community assembly across adjacent biogeographical regions

To test the importance of evolutionary and biogeographical processes in shaping the assembly of local frog communities in two adjacent regions (hereafter, coastal and inland regions) with different historical signatures. We asked two main questions: (1) why does the coastal region harbour more frog species than the inland region? and (2) how do these processes affect the spatial variation in taxonomic, phylogenetic and functional diversities within and across these regions?


| INTRODUC TI ON
The assembly of local communities is often viewed as a process involving dispersal of species from a regional pool (i.e. all species available to colonize a focal site) and filtering by the abiotic environment and biotic interactions (Cornell & Harrison, 2013;Mittelbach & Schemske, 2015). This conceptual framework tries to explain the variation in local species richness (α-diversity) and the turnover of species composition across geographical space (β-diversity), considering a fixed regional pool from which multiple sets of species are drawn (Heino, 2011). However, regional species pools are dynamic, and their compositions change from one region to another (Carstensen et al., 2013;Cavender-Bares et al., 2009;Lessard et al., 2012;Zobel, 1997). This variation in regional species pools strongly reflects the geographical, evolutionary and ecological contexts of different regions (Ricklefs, 1987;Wiens, 2018;Wiens & Donoghue, 2004). For example, local communities within the same biogeographical region tend to share geological events (e.g. mountain uplift), past climatic oscillations (e.g. refugia during the Quaternary climate fluctuations) and contemporary climate conditions, but relatively differ from those in other regions. These factors affect the diversification rate (i.e. speciation minus extinction) and species geographical range expansion, extinction and switching (Matzke, 2013), thereby regulating the size and composition of regional species pools (Cornell & Harrison, 2013;Harrison & Cornell, 2008;Ricklefs, 1987;Roy & Goldberg, 2007;Wiens & Donoghue, 2004).
Another possibility is that some regions might have larger regional species pool because they have been colonized before others, and there has been more time for new species to arise and accumulate in these regions (i.e. the time-for-speciation effect; Stephens & Wiens, 2003). Consequently, the importance of evolutionary and biogeographical processes shaping the spatial variation of local community structures will vary within and among regions (Anacker & Harrison, 2012;Cavender-Bares et al., 2009, 2018Gerhold et al., 2015;Kozak & Wiens, 2012;Leibold et al., 2010;Lessard et al., 2012;Wiens, 2018). Although some studies have evaluated the processes driving community assembly between regions, most of them compare islands (Emerson & Gillespie, 2008) or temperate continental areas (Heino, 2011;Lessard et al., 2012;Qian et al., 2015). Studies evaluating the evolutionary, biogeographic, and ecological processes shaping local community assembly and species co-occurrence at multiple spatial extents (e.g. within and across adjacent geographical regions) are still largely missing (but see Cavender-Bares et al., 2018).
Southeastern Brazil is an excellent study area for examining how large-scale processes shape local community structures at multiple extents. This area encompasses two adjacent but distinct ecoregions (hereafter, coastal and inland regions) that differ in topographic complexity, contemporary climate, and Pleistocene climatic oscillations (Carnaval et al., 2009;Oliveira-Filho & Fontes, 2000). The coastal region has the mountain complex of Serra do Mar with elevation, ranging from sea level up to 2000 m a.s.l., has an annual precipitation of 2500-3600 mm, no dry season, and experienced less variability in temperature and precipitation during the Last Glacial Maximum (LGM) than the inland region. In contrast, the inland region is located on a plateau, with elevation ranging from 300 to 700 m a.s.l., and has an annual precipitation of 1300-1600 mm, seasonal climate, and experienced high variability in temperature and precipitation during the LGM. This region-specific variation should not be interpreted as a nuisance, but as a relevant factor regulating the size and composition of regional species pools. Although previous studies showed that the inland region has more depauperate frog communities than those in the coastal region (e.g. Jenkins et al., 2013;da Silva et al., 2014;Vasconcelos et al., 2019), none have addressed the underlying processes that explain this pattern or what are the consequences of these biogeographical discrepancies for the assembly of local communities.
Here, we combined evolutionary (i.e. phylogenetic comparative methods), biogeographical (i.e. reconstruction of ancestral area), and ecological (i.e. functional and phylogenetic community structures) approaches that are often applied in isolation to infer processes that generate and maintain local frog communities ( Figure 1). Hence, we first generated time-calibrated phylogenies and used evolutionary and biogeographical approaches to understand why the coastal region harbors more frog species than the inland region. We evaluated three non-mutually exclusive hypotheses: The first is the time-forspeciation hypothesis (Stephens & Wiens, 2003) predicting that some regions have higher richness because they were colonized earlier and therefore have had more time for species to accumulate through in situ speciation. Under this hypothesis, we expect that the coastal region had more time for speciation than inland region that was colonized more recently. The second is the diversification rate hypothesis (Ricklefs, 1987) predicting a balance between speciation and extinction rates promoting higher species richness in regions with higher rate of speciation and/or lower rate of extinction than other regions. Under this hypothesis, we expect higher speciation and/or lower extinction rates are in coastal than inland region. One possibility is that the uplift of Serra do Mar mountain range increased the speciation rate in the coastal region, generating species richness through either allopatric or ecological speciation (García-Rodríguez et al., 2020). Another possibility is that the coastal region experiencing milder historical climatic oscillations might have faced lower rates of extinction, leading to an increased accumulation of species through time than inland region (Carnaval et al., 2009). The third is the niche conservatism hypothesis (Wiens et al., 2010) predicting that physiological or ecological conditions constrain species range expansion from their region of origin to other regions. Under this hypothesis, we expect that dispersal rates are different between K E Y W O R D S Anura, Brazilian Atlantic Forest, functional community structure, phylogenetic community structure, phylogenetic signal, Pleistocene climate, reproductive modes, species richness, topographic complexity regions. One possibility is that the low annual precipitation and high seasonality might constrain the dispersal of species with reproductive modes dependent on the humidity gradient from coastal to inland region, but not the opposite (da Silva et al., 2012). Reproductive modes are combinations of traits, including oviposition site, developmental characters, larval habitat and the degree of parental care (Crump, 2015;Haddad & Prado, 2005). Many reproductive modes are convergent in distant related frog families, probably because natural selection favoured similar reproductive behaviours in similar environments (Gomez-Mestre et al., 2012;da Silva et al., 2012).
Therefore, we also evaluated if reproductive modes of frogs display phylogenetic signal (i.e. closely related species tend to be more similar to each other than to species taken randomly in the phylogeny) to understand how the distribution of reproductive mode in the phylogeny is affecting species range expansion (Gomez-Mestre et al., 2012;da Silva et al., 2012).
Then, we used ecological approaches to test how the size and variation in the composition of regional pool of colonists affects F I G U R E 1 Distribution of the 14 protected areas in southeastern Brazil distributed in inland (blue circles) or coastal (green circles) regions. (a) At the top, regional species pools are based on three geographical extents: (1) species from all sites, (2) species from inland sites only; and (3) species from coastal sites only. Species in grey are not present in the regional species pool. Reproductive modes (sensu Haddad & Prado, 2005) are decomposed in multiple traits used to calculate functional community indices (see main text). (b) At the left side, maps representing the distribution of altitudinal, and contemporary and Pleistocene annual precipitation gradients. At the centre, different scenarios illustrating the relationship between spatial distribution of species richness, phylogenetic and functional community structure index, with the effect of environmental gradients changing depending on processes acting in each region entity. We did not represent biotic filter (e.g. competition, predation or facilitation) because species might not be interacting at the spatial scale representing the sampled local communities assembly of local communities at nested spatial extents ( Figure 1): (1) species occurring in coastal sites; (2) species occurring in inland sites; and (3) species recorded in both regions. Therefore, we examined for each spatial extent the relationship between spatial distribution of species richness, functional and phylogenetic community structures with the geological (i.e. topography complexity) and past and contemporary climatic conditions (Figure 1). We predicted a strong imprint from the regions driving the spatial variation of local community structures when both regions are evaluated together (e.g. Anacker & Harrison, 2012;Leibold et al., 2010;Roy & Goldberg, 2007;Zobel, 1997). This is expected because the effects of geology and climate of the regions will generate biogeographical filters along with niche conservatism constraining geographical ranges of species and clades (Figure 1). In this case, the inland region should harbour species-poor assemblages that are phylogenetically and functionally clustered due to abiotic filters excluding species with traits dependent on humid areas (da Silva et al., 2012(da Silva et al., , 2014. In contrast, the coastal region should harbour species-rich assemblages that show random or phylogenetic and functional overdispersion. When downscaling the spatial extent to local communities within each region, we predict distinct results between regions (e.g. Cavender-Bares et al., 2009;Graham et al., 2017;Lessard et al., 2012;da Silva et al., 2014). This is expected based on two hypotheses: (1) the species pool hypothesis (Zobel, 1997), which states that the number of species in a given site may largely reflect the regional availability of species capable of dispersing to and existing within a locality; and (2) the environmental heterogeneity hypothesis, which states that areas that encompass a greater range of local conditions provide more opportunities for the establishment of species from the regional pool (Huston, 1999). If these predictions are true, we also expect to find discrepancies in the variation of taxonomic, phylogenetic and functional β-diversity across regions, but not within each region (e.g. Graham & Fine, 2008).

| Species occurrence data
We collected frog species presence-absence data in 14 protected areas, spanning 4° of latitude and 6° of longitude and encompassing a spatial extent of 98,000 km 2 in southeastern Brazil (Figure 1).
Seven of these protected areas are within the inland region encompassing a spatial extent of ~19,400 km 2 , with an average linear geographical distance of 152.5 ± 86.5 km between areas. The other seven protected areas are within the coastal region encompassing a spatial extent of ~12,000 km 2 , with an average linear geographical distance of 159.5 ± 91 km between areas. We delimited a similar spatial extent for each region (Figure 1) to prevent the number of species within and across regions from being affected by species-area relationships (Catano et al., 2020). Furthermore, we selected local communities considering that their geographical isolation across regions should be similar to geographical isolation within each region. This criterion reduces potential effects generated by long-distance dispersal among local communities from different regions.
We conducted field samplings using standardized methods between December 2014 and February 2017, totalling 27 days (9 days per year) of field work in each protected area. We sampled six breeding sites in each protected area: two ponds, two streams and two transects inside forest fragments (Supplementary material Table S1). We selected these habitats because they encompass all environments used by frog species for breeding (Haddad & Prado, 2005). We used three methods to record species presence: (1) Surveys at breeding sites, which consist of recording the call of males from 19.00 hours to 24.00 hours; (2) Surveys of larvae by dipnetting, (3 mm 2 mesh size) along the margins of ponds and streams, sampling the available microhabitats from 12.00 hours to 18.00 hours; and (3) Visual encounter surveys, which consist of walking slowly for 30 minutes in trails inside forest fragment, streams and around ponds looking at microhabitats for individuals hidden under trunks, bromeliads, stones, branches and leaf litter.

| Phylogenetic inference
We built phylogenies using two backbone trees considering the relationships of frog genera proposed by Pyron (2014;see Fig. S1) and frog families proposed by Feng et al., (2017;see Fig. S2). We chose these phylogenies because they are the most recent ones and cover most of the frog families recorded in our study area.
We compiled a molecular dataset including three mitochondrial genes fragments-the 12S ribosomal RNA (~1000 bp), the 16S ribosomal RNA (~1550 bp) and cytochrome c oxidase subunit I (COI; ~640 bp)-and one nuclear gene fragment-the recombinationactivating gene 1 (RAG-1; ~420 bp). We sequenced 296 gene fragments, while 622 were obtained from GenBank based on the species for which the four markers were available (see Appendix A and Tables S2 and S3 for more details). The final dataset contained 248 species.
The GTR+GAMMA+I model was selected as the best model for all genes (see Table S4 for all results). We used penalized likelihood (Sanderson, 2002) implemented in the chronos function in ape R package (Paradis & Schliep, 2018) to estimate divergence dates. We used two phylogenies to constrain the ages of nodes: the ages of families and genera estimated by Pyron (2014;see Fig. S1) and the ages of families estimated by Feng et al., (2017;see Fig. S2). We performed all subsequent analysis considering the two phylogenies. Results were similar and, for brevity, only the results based on Pyron's phylogeny are presented in the main text (see Tables S5-S7 and Figs S2-S5 for Feng's phylogeny).

| Species traits related to reproduction
We used reproductive modes to understand their role in species distributions (see Gomez-Mestre et al., 2012;da Silva et al., 2012).
Reproductive modes were expressed as a combination of binary traits considering (Table S8): (1) habitat(s) where eggs are deposited (e.g. lentic habitats, lotic habitats, arboreal plants, soil, leaves, rocks or carried by adults), (2) the presence of foam nests, (3) site of tadpole development (e.g. lentic habitat, lotic habitats, arboreal plants or structures build on the ground), (4) direct development and v) tadpole feeding (e.g. endotrophic or exotrophic). Although, a given trait may influence species distributions, it is hard to believe that a single trait is sufficient to alone determine community assembly.
Furthermore, most traits are measured on adult individuals, whereas eggs and larval stages are the most vulnerable to environmental stress (Crump, 2015). Thus, we believe that life-history strategies,

| Species richness
We used sampled-based rarefaction to estimate species richness based on the 27 days of sampling and an extrapolation approach to 50 days of sampling (Chao et al., 2014). This approach uses bootstrap replications to estimate species richness and obtain unconditional variances and 95% confidence intervals (CI) for all rarefied and extrapolated estimators (Chao et al., 2014). We used the iNEXT package (Hsieh et al., 2020), which uses species frequencies of occurrence from each sample as input data to compute estimated total species richness.

| Phylogenetic signal
To measure and test for phylogenetic signal, we first calculated a pair-wise distance matrix between reproductive modes using simple matching coefficient (Gower & Legendre, 1986) as coefficient of dissimilarity. We then calculated trait diversity, as Rao's quadratic entropy, which was decomposed along the nodes of the phylogeny (Pavoine, Baguette, & Bonsall, 2010). In this approach, a phylogenetic signal exists when trait diversity is skewed towards the root of the phylogeny, whereas convergent evolution exists when trait diversity is concentrated at nodes closer to the tips (Pavoine et al., 2010). This analysis was performed in the adiv (Pavoine, 2020)

| Diversification and dispersal between regions
We tested for differences in speciation, extinction and dispersal rates between the inland and coastal regions using GeoSSE (Goldberg et al., 2011) implemented in the diversitree package (FitzJohn, 2012).
We built nine models with varying speciation, extinction and dispersal rates between regions (see Table S10). Then, we fit the models to the data and ranked them using the Akaike information criterion (AIC; Burnham & Anderson, 2002). To account for parameter uncertainty, we sampled the posterior probability distribution of those parameters using Markov Chain Monte Carlo (MCMC) after running 1000 generations.
Estimates of the origin and evolution of Serra do Mar mountain chain indicate that it was formed by two events (Zalan & Oliveira, 2005

| Relative timing of colonization
We estimated colonization timing by reconstructing the geographical area that ancestral species inhabited using the unconstrained DEC model in BioGeoBEARS R package (Matzke, 2013). Then, we inferred the approximate timing of the first colonization of coastal and inland regions using two standard approaches (Hutter et al., 2013(Hutter et al., , 2017Kozak & Wiens, 2012;Wiens et al., 2007): (1) by identifying the divergence date of the oldest node occurring in each region.
In this case, we considered the age of nodes within the superfamily Hyloidea, whose origin is associated with South America and not the nodes within Microhylidae, whose origin is associated with Africa (Feng et al., 2017;Pyron, 2014); and (2) by identifying multiple colonizations considering the divergence date of the oldest split for the seven largest families sampled in the study (Microhylidae, Hylidae, Leptodactylidae, Bufonidae, Hylodidae, Cycloramphidae and Brachycephalidae). We acknowledge that considering only species sampled in our study could bring considerable uncertainty in estimating ancestral geographical areas and time of colonization.
Thus, to account for these uncertainties, we also calculated, in addition to the divergence time of the oldest split (crown age), the colonization time for stem ages providing a maximum estimate of the age of colonization of a given region. Nevertheless, we sampled a reasonable proportion of species present in these regions (Fig.   S6) and the relationship between age of colonization and species richness is strong.

| Phylogenetic and functional diversities
We calculated two metrics of phylogenetic community structure that are sensitive to processes operating at different phylogenetic depths (Webb et al., 2002) using the picante R package (Kembel et al., 2010). The first metric is the mean pairwise distance (MPD), which is strongly influenced by relationships near the root of the tree (Webb et al., 2002). The second metric is the mean nearest taxon distance (MNTD), which describes relationships closest to the tips of the tree (Webb et al., 2002). We used the same metrics to calculate functional diversity based on data of reproductive modes. The functional analogue of MPD (F-MPD) quantifies the mean distance between all co-occurring species in functional space. The functional analogue of MNTD (F-MNTD) quantifies the mean distance between each species and its nearest neighbour in the functional space. We calculated the simple matching coefficient for binary variables (Legendre & Legendre, 2012) to generate the functional distance matrix representing the functional dissimilarity between species in multivariate trait space.

| Taxonomic, phylogenetic and functional βdiversity
We used the Jaccard index to calculate taxonomic dissimilarity among species occurring in different sites using the vegan package (Oksanen et al., 2019). We calculated two metrics of phylogenetic β-diversity that are an extension of the MPD and MNTD using the picante package (Kembel et al., 2010). COMDIST computes the mean phylogenetic distance between species occurring in pairs of sites. This metric captures the variation associated with the root of the phylogeny. COMDISTNT computes the mean phylogenetic distance between every species in a site and the nearest phylogenetic neighbour in another site. This metric captures the variation associated with terminal nodes indicating the importance of recent events. We used the same metrics to calculate functional β-diversity (F-COMDIST and F-COMDISTNT) based on the distance matrix of traits.

| Standardized effect size
Because Jaccard, MPD, MNTD, F-MPD, F-MNTD, COMDIST, COMDIST, F-COMDIST and F-COMDIST can be influenced by species richness, we calculated standardized effect size (SES) based on null models considering the concepts of ( Figure 1): (1) 'the dispersal field species pool', which states that all communities sharing at least one species with the focal community will compose its pool (Lessard et al., 2012); and (2) 'the biogeographical species pool', which uses biotic assemblage similarities to delimit ecoregions (Carstensen et al., 2013). Then, we generated null distributions of the nine metrics by randomizing species co-occurrences 999 times while maintaining both sample richness and occurrence frequency using the independent swap algorithm (Kembel, 2009). Positive SES indicates lower values than expected by chance (i.e. clustering), while negative SES indicates dispersion. We emphasized that our primary interest is not in the statistical significance of SES, but how values change along environmental gradients.

| Relationships between local community structures and environmental gradients
We generated alternative models to describe the variation in species richness, phylogenetic and functional diversities with different combinations of predictor variables (topographic complexity, as well as contemporary and Pleistocene climate gradients) using generalized least squares taking spatial autocorrelation into account by fitting an exponential spatial covariance structure (Dormann et al., 2007). We also included the inland and coastal regions as a predictor variable for models considering in the analysis conducted across the two regions. Then, we ranked models using the Akaike information criterion corrected for small sample sizes (AICc; Burnham & Anderson, 2002). We considered models in which the difference in AICc relative to AICc min is <2.0 as good support for the data. In addition, we used the weight of the model AICc (wAICc) to evaluate the uncertainty of the model selection (Burnham & Anderson, 2002). All analyses were performed separately for the three spatial extents in R version 4.0. (R Core Team, 2020).

| RE SULTS
We found 112 frog species from 33 genera and 11 families in the regional pool comprising all sites, 89 species from 31 genera and 11 families within the coastal region, and 37 species from 15 genera and 6 families within the inland region ( Figure 2). Species richness per site ranged from 16 to 26 within the inland region and from 34 to 46 within the coastal region (Fig. S6). The estimated species richness showed a tendency to reach asymptote in species-poor assemblages within the inland region, but not in the species-rich assemblages within the coastal region (Fig. S6).  Table S8). The third greatest trait diversity was in the node representing the MRCA of Cycloramphidae and Hylodidae, which have aquatic eggs and tadpoles associated with streams ( Figure 2, Table S8).

| Diversification and dispersal between regions
At least three models had good support (Table S10). The model with equal dispersal and extinction rates between inland and coastal areas was ranked as the best model with weight of 23% (Table S10). The speciation rate estimated by this model was twice as high for coastal lineages (mean =0.02, range from 0.01 to 0.04) than for inland lineages (mean =0.01, range from 0.002 to 0.03; Figure 2). The second-best model (∆AIC =0.2, weight =0.21, Table S10) had equal extinction rates for inland and coastal areas, while speciation and dispersal rates between regions were free to vary. It estimated that the dispersal rate from inland to coastal region was an order of magnitude higher (1 × 10 −2 ) than the opposite (7 × 10 −3 ). The third-best model support (∆AIC =0.9, weight =0.15, Table S10) had equal speciation and extinction rates for inland and coastal areas, while dispersal rate was free to vary. It estimated higher dispersal rate from inland to coastal region (1 × 10 −2 ) than the contrary (6 × 10 −3 ).
Taken together, the three GeoSSE models that best fit to the data suggest that differences in both speciation and dispersal rates are the key processes generating the species richness gradient between regions. Additionally, the LTT plot showed that the periods with changes in the slope of lineage diversity overlap with the estimated periods of mountain uplift (Figure 2), suggesting that uplifts of the Serra do Mar have promoted speciation events and have been responsible for differences in speciation rates between regions.

| Time of colonization
Ancestral area reconstructions suggest that lineages of hyloid frogs were present much earlier (144.2 and 73.53 myr for stem and crown ages respectively) in the coastal than inland (55.4 and 41.6 myr for stem and crown ages respectively) region ( Figure 3). Furthermore, families present in the coastal region are older than those in the inland region, and some families such as Brachycephalidae and Cycloramphidae have no extant lineages occurring in the inland region (Figures 2 and 3). These results suggest that colonization time has an important role regulating the size and composition of regional species pools between regions.

| Relationships between functional and phylogenetic diversities and environmental gradients
Neither functional nor phylogenetic alpha diversities were associated with environmental gradients when evaluating only sites within each region (Figure 4, Tables S5-S7). In contrast, models using regions as a predictor were the best to explain the data when all sites are evaluated together, except for FMPD (Figure 4, Table S7). For example, alpha diversity was lower within the inland than the coastal region ( Figure 4P, Table S7). Within the inland region, the numbers of genera per site ranged from 7 to 10 (average 8.85 genera) and families from 3 to 6 (average 4.1 families). Within the coastal region, the numbers of genera per site ranged from 16 to 24 (average 20.5 genera) and families from 7 to 11 (average 9.5 families) (Figure 2).
Consequently, local communities within the inland region contained more closely related species than the coastal region ( Figure 4R). SES.FMPD was the only metric associated with the gradient representing the difference between Pleistocene and contemporary climatic conditions and not with biogeographical regions (Figure 4, Table S7). Local communities embedded in areas with harsher past climate contain lower variability in traits (i.e. were functionally clustered) than those that had more suitable past climate conditions ( Figure 4J, Table S7).

| Taxonomic, phylogenetic and functional βdiversity within and across regions
When all sites are evaluated together, pairwise taxonomic, phylogenetic and functional β-diversity within the inland region were smaller than expected by chance while within the coastal region were close to random ( Figure 5). In contrast, between local communities from different regions, they were higher than expected by chance ( Figure 5). These patterns suggest that sites in different regions are harbouring different lineages and traits with sites within the inland region containing a limited number of lineages and reproductive traits compared to a random draw from the regional species pool.  Pyron (2014). White circles indicate decomposition of reproductive mode diversity, calculated as Rao's quadratic entropy, along the nodes of the phylogeny (Pavoine et al., 2010). Tips represent the reproductive modes (RM -sensu Haddad & Prado, 2005) associated with each frog species. Blue bars indicate the seven inland sites, while green bars indicate the seven coastal sites. Black circles indicate the presence of frog species in each site. For the generic and family assignment of species, we followed Frost (2020) Scaling down the spatial extent to local communities within regions, pairwise taxonomic, phylogenetic and functional β-diversities were similar to random ( Figure 5).

| DISCUSS ION
A long-standing challenge in biogeography and ecology is to tease apart the influence of historical and contemporary processes in determining the structure of communities. Here, we tested how rates of speciation, extinction and dispersal between different regions affect the geographical distribution of taxonomic, functional and phylogenetic structure of local communities at multiple spatial scales. We found that the size of the regional species pool was two times greater in the coastal than in the inland region. This pattern seems to reflect both higher speciation rate and earlier time of colonization in coastal than inland region. Furthermore, the absence of some frog lineages with specialized reproductive modes in the inland region suggest that physiological or ecological tolerances are preventing coastal species and clades from invading the inland region (i.e. niche conservatism, Wiens et al., 2010). Thus, the lineage diversification processes within each region and the limited range expansion of species from lineages with reproductive modes dependent on high humidity have a strong role shaping local frog communities between regions (i.e. biogeographical filter), but not within them.

| Why does the coastal region harbour more frog species than the inland region?
Spatial and phylogenetic scales are common factors associated with difference between diversification rates and time-for-speciation explaining patterns of species richness (Pontarp & Wiens, 2017; Wiens, F I G U R E 3 Ancestral area reconstruction of frog lineages based on the DEC model with areas unconstrained. Pie charts in the nodes of the phylogeny show the relative probability of geographical ranges in two adjacent regions of southeastern Brazil. The pies positioned below and above each node are representing the geographical range immediately after a cladogenesis event. Tips are represented with present-day species distributions. Species occurring in the coastal region are represented by green, in the inland region by blue and in both regions by white. Coloured rectangles in the phylogeny highlight the seven frog families whose time of first colonization was estimated for each region. Hourglasses represent the colonization time for each region considering stem (S) and crown (C) ages. The number inside the frog silhouette represents the species richness for the superfamily Hyloidea (left side) and the seven families (right side) in each region. '-' indicates that no species has been recorded in the region 2018; Wiens et al., 2011). Theoretical predictions and empirical evidence have suggested that the time-for-speciation effect dominates richness patterns over shallow timescales (e.g. a single frog family), whereas diversification rates dominate over deep time (Hutter et al., 2017;Pontarp & Wiens, 2017;Wiens et al., 2011). However, this pattern is not a rule and the way diversity accumulates in different regions must be shaped by both processes (Smith et al., 2007). This is the case of our study, in which both diversification rate and time for speciation explained why there are more frog species in the coastal than in the inland region. However, these results should be taken with caution because we inferred processes using an incomplete phylogeny based only on frog species sampled in our study area. As a result, some colonization events in a region may be missed by species not being recorded in the communities, generating uncertainties in the colonization time and diversification rates inferred. However, including missing species would likely have little impact on the observed patterns, because we sampled most families and genera present in these regions.
Other interesting finding is that the absence of species from genera possessing reproductive modes dependent on humidity in the inland region fits the niche conservatism hypotheses (Wiens et al., 2010). For example, species from genera with reproductive modes associated with bromeliads, streams or direct development, such as Ischnocnema, Dendrophryniscus, Fritziana, Cycloramphus, Hylodes, Thoropa and Vitreorana were common in local communities F I G U R E 4 Generalized least squares (GLS) showing the relationship between frog species richness, phylogenetic (Standardize Effect Size of Mean Phylogenetic Distance-MPD, and Mean Nearest Taxon Distance-MNTD), and functional (SES of FMPD and FMNTD) diversities, and contemporary climate gradients (a-e), difference between Pleistocene and contemporary climate gradients (f-j), topographic complexity (k-o), and biogeographical regions (p-t) considering 14 protected areas in southeastern Brazil. The GLS were performed separately for three spatial extents: (1) all sites (grey), (2) inland sites only (blue); and (3) coastal sites only (green). Gradients are represented by the first axis of principal component analysis. Solid lines represent p < 0.05 while dashed lines represent p ≥ 0.05 within the coastal, but not in the inland region. One explanation why these lineages were absent from the inland region is that the coastal region, which experienced higher climatic stability during the Pleistocene, could have favoured frog species dependent on humidity and had lower extinction rates than species in the inland region which experienced higher climatic oscillations (Carnaval et al., 2009;García-Rodriguez et al., 2020). This pattern was observed for amphibian species richness across mountains of the world, in which mountains experiencing milder historical climatic oscillations faced lower extinction rates, leading to an increased accumulation of amphibian species through time (García-Rodriguez et al., 2020). In this scenario, regions that experience historical climatic stability might favour the F I G U R E 5 Boxplot showing the Standardized Effect Size (SES) of taxonomic, phylogenetic (Mean Phylogenetic Distance-COMDIST, and Mean Nearest Taxon Distance-COMDISTNT), and functional (FCOMDIST and FCOMDISTNT) β-diversity. These metrics were calculated considering the regional pool encompassing all frog species recorded in 14 protected areas in southeastern Brazil (a-e) and regional pools of inland or coastal regions (f-j). Values between dashed lines indicate that β-diversity metrics have no difference with respect to null expectation time-for-speciation hypothesis by acting as a museum maintaining and accumulating old lineages that arise or colonize it through time.
Mountains might also increase the diversification rate by acting as a cradle, playing a key role in allopatric and ecological speciation, affecting diversification rates among regions (García-Rodrigues et al., 2020;Hutter et al., 2017), and making them epicentres for smallranged species (Rahbek et al., 2019;Vasconcelos et al., 2019). We found that the coastal region harboured not only more species, but they were also younger whose emergence coincides with the uplift of the Serra do Mar. Rahbek et al., (2019) using simulations showed that mountains in the Atlantic Forest are both cradles (i.e. areas of high rate of species origination) and museums (i.e. areas of long-term persistence of species) for amphibians. Our study brings empirical evidence for these simulations showing that the coastal region is acting as a cradle and museum for frog lineages. Therefore, we demonstrated that the marked difference in species richness and lineages of frogs across regions may be interpreted based on diversification rates, early colonization of coastal region and niche conservatism, which constrain some lineages from colonizing the inland region.

| Spatial extent and local community structure
At the largest spatial extent, we found that the spatial variation of local community structures depended on the region, with the size of the regional species pool being two times greater in the coastal than in the inland region. These results support the species pool hypothesis and imply that the availability of species within regions is an important determinant of local communities (Harrison & Cornell, 2008;Heino, 2011;Zobel, 1997). Conversely, there was no association between environmental gradients and spatial variation of phylogenetic and functional diversities when scaling down to local communities within regions. This is interesting because although regions having showed discrepancies in the size and composition of their regional species pools and high variability for past and contemporary climate conditions, local assemblages within the same region had similar values of taxonomic, phylogenetic and functional alpha diversities within the same region. These results contradicted our initial hypotheses that predicted different patterns within regions due to differences in their regional species pools or environmental heterogeneity. Several studies showed that associations between variables may disappear or change in sign from negative to positive, depending on the spatial grain and extent (Cavender-Bares et al., 2009), phylogenetic scale (Graham et al., 2017) or species pool definition (Lessard et al., 2012(Lessard et al., , 2016 over which communities are studied. For example, studies evaluating the variation of taxonomic beta diversity of tadpoles in the Brazilian Atlantic Forest (Melchior et al., 2017) and freshwater organisms across various drainage basins in Finland (Heino et al., 2017) found that stochastic and species sorting processes were related to beta diversity variation at small scales, while processes restricting species distributions were more influential at large spatial scales. This occurs because large spatial extents emphasize the role of speciation, dispersal limitation and environmental filters that accentuate the imprint of biogeographical history of regions (Cavender-Bares et al., 2009;Heino, 2011;Leibold et al., 2010;Ricklefs, 1987). The nested spatial extents of our study allowed us to detect the effects of evolutionary and ecological processes generating differences in the regional species pools between regions, but not the mechanisms shaping the local communities within regions. We suggest two non-mutually exclusive explanations for the local community structure within regions. The first is that the regional species pool of each region has already passed through a strong biogeographical filter and the environmental conditions are no longer constraining species from colonizing local communities within regions. In this case, stochastic processes could be acting in the assembly of local communities (Hubbell, 2001). The second is that biotic interactions and abiotic environmental variables potentially operating at different spatial scales (i.e. smaller grain size) and not measured in this study may be acting in the assembly of communities within regions (Anacker & Harrison, 2012;Cavender-Bares et al., 2018;Huston, 1999;Lessard et al., 2016;Melchior et al., 2017). However, both scenarios require additional data and are beyond the scope of this study.
One interesting result was that in contrast to patterns explained by regions, the distribution of functional community structure was associated with the climatic conditions of the Pleistocene. In this case, local communities in areas that experienced high climatic oscillations had lower variability in reproductive modes (i.e. functionally clustered) than communities in areas that experienced more suitable past climates. This clustered pattern results from the absence of species from genera possessing reproductive modes associated with direct development (e.g. Ischnocnema), tadpoles in bromeliads (e.g. Dendrophryniscus and Fritziana) or eggs and tadpoles developing in streams (e.g. Cycloramphus, Hylodes, Thoropa, and Vitreorana) in the local communities in areas with high climatic oscillations. This pattern associated with the fact that reproductive modes within genera were less variable than among families (i.e. phylogenetic signal) fits the niche conservatism hypothesis that predict that communities developing under more stressful conditions are more strongly structured by environmental factors (Wiens et al., 2010). A phylogeographic study performed in the same region showed that areas with climatic instability in the Pleistocene lost some amphibian species with broader ranges, which are recolonizing the region from adjacent refugial populations (Carnaval et al., 2009). These results indicate that processes that occurred in the past may continue to influence community assembly today. Studies evaluating the effect of current climate on community composition also observed that communities in drier areas contain sets of amphibian species with non-random subsets of reproductive modes than those displayed by species from areas with high annual precipitation and low precipitation seasonality (Gomez-Mestre et al., 2012;da Silva et al., 2012). Taken together, these results indicate that past and current climate conditions jointly play a major role in shaping present-day community assembly by constraining some frog lineages from colonizing local communities in regions characterized by low humidity conditions.

| CON CLUS ION
Community ecology, macroecology, evolution and biogeography have built up the knowledge related to the causes and underlying processes shaping species distributions and diversity patterns.
However, understanding how biodiversity emerges and how it varies in space and time requires theories that transcend the boundary between disciplines. Here, we linked evolutionary, biogeographic and ecological approaches and found that processes acting at broad spatial scales are determining the size and composition of regional pool within the coastal and inland regions.
Consequently, the disparity in species richness, as well as local phylogenetic and functional community structures result from processes related to the geology, past climate and contemporary climate properties that are spatially structured across regions.
These gradients jointly influenced the diversification processes across regions and constrained some frog lineages with reproductive mode traits associated with streams, bromeliads and direct development from colonizing local communities within the inland region. Although disentangling the effects of processes acting at historical and contemporary scales is not an easy task, the combination of approaches from different disciplines provided insights about processes acting at large spatial scales and their effects on the present-day community assembly.

ACK N OWLED G EM ENTS
We thank John Wiens, Pedro Peres-Neto and two anonymous reviewers whose comments on a previous draft helped us improve