Functional redundancy of Amazonian dung beetles confers community‐level resistance to primary forest disturbance

Tropical forest biodiversity is being threatened by human activities, and species losses during forest disturbance can compromise important ecosystem functions and services. We assessed how species losses due to tropical forest disturbance affect community functional structure, using Amazonian dung beetles as a model group. We collected empirical data from 106 forest transects and used simulated extinction scenarios to determine how species loss influences community structure at regional and local scales. Although functional and taxonomic community metrics were largely unaffected by primary forest disturbance, they differed markedly between primary and secondary forests. However, our extinction scenarios demonstrated scale‐dependence of species losses, whereby functional structure only eroded with species extinction at the local scale. Hence, we extend the spatial insurance hypothesis by demonstrating that landscape‐scale functional redundancy offsets the impact of local species losses and confers community‐level resistance to primary forest disturbance.


| INTRODUC TI ON
Human activities cause changes in most terrestrial (Newbold et al., 2015) and aquatic ecosystems (Castello et al., 2013;Halpern et al., 2008), leading to a loss of biodiversity and ecosystem functions (Mitchell et al., 2015;Newbold et al., 2020). Although tropical forests contain >60% of global terrestrial biodiversity (Slik et al., 2015), they are subjected to a multitude of stressors interacting at different scales . At the regional scale, disturbances are often related to deforestation , resulting in fragmentation and edge effects in the remaining forests (Baccini et al., 2017;Malhi et al., 2014). At the local scale, withinforest disturbances related to fires, logging, and hunting greatly reduce the overall conservation value  and the capacity of the forest to supply goods and services (Parrotta et al., 2012).
Ecosystem functions are driven in part by species ecological traits (Cadotte et al., 2011) and therefore taking into account the functional structure of communities could improve our understanding of the links between biodiversity and ecosystem functioning (Gagic et al., 2015), and might elucidate how disturbance-driven changes in biological communities impair ecological processes (Beiroz et al., 2018;Cadotte et al., 2011;Leitão et al., 2018). In metacommunities, local community compositions vary and species with different traits fulfil different functions in each of these local communities. The "spatial insurance hypothesis" proposes that the spatial variability of local community composition insures the ecosystem functioning at larger scales, by allowing compensations between species Wang & Loreau, 2014). In this context, it is crucial to establish whether species that are more sensitive to human activities contribute more or less to the functional structure of communities. Rare species are more prone to extinctions (Davies et al., 2004;Harnik et al., 2012;Sykes et al., 2019) because they have small population sizes, restricted geographic ranges, and narrow environmental tolerances. However, despite their low numeric representation, there is increasing evidence that rare species can perform unique functional roles and contribute disproportionately to the functional diversity of communities (Jain et al., 2014;Leitão et al., 2016;. Hence, the loss of rare species due to local forest disturbance could reduce functional diversity and ultimately threaten ecosystem functioning (França et al., 2020).
Most studies of anthropogenic disturbances focus on vertebrates and plants (Pereira & Cooper, 2006). However, invertebrates, especially arthropods, perform many irreplaceable ecosystem functions (Cardoso et al., 2011). Given the enormous diversity of invertebrates in the tropics, we should focus on taxa that we know to perform important functions within the ecosystem, and for which we have well-established taxonomies and existing functional trait data. Dung beetles (Coleoptera: Scarabaeidae: Scarabaeinae) are one such focal taxon: they play critical roles in detritivorous pathways , are abundant and diverse, and their sampling is highly costeffective (Gardner et al., 2008;Halffter & Favila, 1993). Due to their feeding and nesting habits, they perform key ecological functions such as dung removal, soil fertilization and aeration, and secondary seed dispersal (Nichols et al., 2008). Furthermore, dung beetles are sensitive to both natural (Beiroz et al., 2017) and anthropogenic disturbances (Gómez-Cifuentes et al., 2017) and their functional traits related to dung removal and burial are well studied (deCastro-Arrazola et al., 2020;Griffiths et al., ,2015Griffiths et al., , , 2016, including how functional traits of dung beetle communities respond to changes in the environment (Beiroz et al., 2017).
We used data collected from 161 sites in the Eastern Brazilian Amazon to simulate extinction scenarios and to test the following hypotheses: 1. Forest disturbance negatively affects dung beetle community taxonomic and functional structure, and ecological function (dung removal). Therefore, species richness, abundance, Functional Richness, Functional Specialization, Functional Originality, and dung removal will decrease in disturbed forests compared to primary undisturbed forests.
2. The extinction of rare species during forest disturbance will result in a greater erosion of community functional structure than the loss of common species. Thus, the declines in Functional Richness, Functional Specialization and Functional Originality will be faster in scenarios where rare species are lost first than in scenarios where common species are lost first.
We defined species rarity and tested our first hypothesis using data collected from sites along a gradient of human disturbance to assess the impact of forest disturbance on dung beetle communities and their contribution to dung removal -a key ecological function for soil nutrient cycling (Nichols et al., 2008). We then tested our second hypothesis by simulating species loss at local and regional scales to assess the effects of distinct extinction scenarios on community functional structure.

| Study site and design
Our data were collected from 161 transects located in the eastern Brazilian Amazon, covering the municipalities of Santarém, Belterra, and Mojuí dos Campos (2.7 million ha in total), hereafter Santarém ( Figure 1). The region in the Brazilian state of Pará, experienced an increase in colonization from the 1970 decade, which increased deforestation in the region, with it peaking in the early K E Y W O R D S extinctions, insurance hypothesis, rarity, resistance, scarabaeinae, tropical forest degradation 2000s (Gardner et al., 2013). The current landscape is a mosaic of undisturbed primary forests, pastures, agriculture fields, degraded primary forests, and secondary forests (Gardner et al., 2013). The climate in the region is classified as tropical, receiving ~2000 mm of rainfall/year and a mean annual temperature of 26ºC (Andrade & Corrêa, 2014).
Eighteen hydrological catchments (c. 5000 ha each) across the region were selected for sampling, and eight to 12 transects were installed in each catchment. The catchments presented a gradient of forest cover and anthropogenic land-uses. Each transect was 300 m in length and separated by at least 1.5 km (Figure 1). Transects were distributed within forest and nonforest land cover. Forested transects (106 in total) included primary (undisturbed, logged, burned, and logged-and-burned) and secondary forests (i.e., those regenerating in previously deforested land). Nonforest transects included pasture, mechanized agriculture, abandoned plantation, fruticulture, and tree plantation (55 transects in total). To test the influence of time since the occurrence of disturbance on dung beetle communities, we obtained, for each forest site, the time since last disturbance (primary forests) or regeneration age (secondary forests) by combining visual analysis of Landsat images (1988 to 2010 in twoyear intervals) with a visual field assessment (Gardner et al., 2013).
For undisturbed primary forests, we attributed an arbitrary value of 50 years since last disturbance. For those forests in which we found physical evidence of disturbance before 1988 (e.g., cut trees, fire scars), we attributed an arbitrary value of 25 years since previous disturbance. Additional information on the study design can be found in Gardner et al., (2013). All statistical analyses and simulations in this study were performed in R version 3.4.2 (R Core Team, 2017) unless otherwise stated.  Table S1). Dung beetles were taken to the lab where they were dried and identified to species level or the lowest possible taxon.

|
Voucher specimens were deposited in the Zoological Collections at the Universidade Federal de Mato Grosso and Universidade Federal de Lavras, Brazil.

F I G U R E 1
Map of study site and the study design. Dung beetles were collected in the Santarém region of the eastern Amazon, in the Brazilian state of Pará. We sampled dung beetle diversity and functions in transects of 300 m. We used these samplings to assess dung beetle species rarity, taxonomic and functional diversity, and ecological function of dung removal niche breadth relative to the niche space of the region, and the tolerance metric describes the spatial variance of the niche across measured environmental conditions or resources (Dolédec et al., 2000).
We used tree species richness, aboveground biomass, understorey density, canopy openness, soil texture, and elevation (Appendix S1 -section A) to estimate the HB of each dung beetle species. We calculated the rarity index (RI) for each species using LA, GR, and HB, following Leitão et al., (2016). We first log-transformed each metric and then standardized the data by dividing each value by the maximum value across all species, to give values between 0 and 1 for each metric. We also accounted for the degree of dependence among the three metrics by weighting each by its correlation with the other two.
The rarity index for a species i (RI i ) was calculated by the following formula: where w la , w gr , and w hb are the weighting parameters for local abundance, geographical range, and HB, respectively. The weighing parameter for each metric x was calculated by the following formula: where r x1 and r x2 are the Pearson's correlation coefficients between the given metric x and each of the other two metrics. Values of RI i range between 0 and 1, whereby the rarest species have values close to 0 and the most common species have values close to 1; for clarity of discussion, we thus refer to species with RI <0.5 as "rare" and to those with RI >0.5 as "common". For six species that were only collected in 2016, we calculated GR from the 37 transects sampled in that year. Since we were interested in testing hypotheses related to species rarity, we excluded from the analyses seven species that are known not to be attracted to mammal dung and are therefore undersampled by baited pitfall traps: five species of the genus Anomiopus, as well as Bdelyrus paraensis and Dendropaemon aff. refulgens (18 individuals in total).

| Community functional structure
We assessed dung beetle functional traits from individuals sampled in the 37 forest transects in 2016: five undisturbed, five logged, five burned and 15 logged-and-burned primary forest, and seven secondary forest sites ( Figure 1, Table S1). To obtain trait data that accurately predict ecological functions, we recorded a suite of measurements on all individuals for species with <50 individuals and at least 50 individuals of all other collected species (Griffiths et al., 2016). Individuals were dried in the lab and weighed with a precision balance (0.0001 g). We then used digital calipers to measure: i) front leg length, ii) back leg length, and iii) pronotum width. The combined measurements gave the following functional traits: i) body mass (BM), ii) front leg length/BM, iii) pronotum width/BM, iv) back leg length/front leg length (Griffiths et al., 2015). We calculated the median value of each trait for each species, pooling data of traits from all forest classes. We also obtained information on v) dietary habit (coprophagous, necrophagous, and generalist), and vi) the functional guild of dung beetles (roller, dweller, or tunneler) following Halffter and Edmonds (1982), Griffiths et al., (2015) and Beiroz et al., (2017).
The functional meaning and the relationship of each trait to dung beetle ecological functions are described in Table 1.
The trait measurements from the 37 transects gave functional trait data for 67.8% of all species collected in the 106 forest transects in 2010 (61 out of 90 species), representing 87.6% of the total abundance of dung beetles. As functional trait data were lacking for some species, we completed the dataset by extracting additional information on functional traits from the literature (Beiroz et al., 2017;Griffiths et al., 2015) and by estimating traits based on species BM.
For the trait estimates, we used linear regressions of each measured trait against BM, using functional data for genera. We used functional data for tribes for seven genera, which each have ≤ five species. We then used the equation of the regression to estimate the value of each trait for a given species using its mean BM (See Appendix S1section B). In total, we measured BM of 83 species (3,658 individuals) and functional traits of 61 species (2,482 individuals). We estimated traits for 22 species based on measured BM, estimated traits for four species based on BM extracted from the literature and excluded three species for which we could find no functional trait data.
To assess the functional structure of dung beetle communities, we used data from the 106 forest transects sampled in 2010 (Table   S1) to calculate Functional Richness (FRic), Functional Specialization (FSpe), and Functional Originality (FOri) following . FRic is defined as the convex hull volume of the functional space filled by all species of a given community. The functional space was formed by PCoA axes, obtained using the functional distances of each pair of species based on Gower distance. We then used three PCoA axes to calculate the indices after evaluating the quality of functional space using the method proposed by Maire et al., (2015).
FSpe is calculated from the mean Euclidean distance between each species and the centroid of the species pool in the functional space, and FOri is expressed as the mean distance between each species and its nearest neighbor in functional space (Mouillot, Graham, et al., 2013). Communities with many highly specialized species that perform specific functions have high FSpe and FOri values whereas high functional redundancy is indicated by low FSpe and FOri values. We standardized all three indices to values between 0 and 1: i) expressing FRic as a proportion of the volume filled by the total pool of species in the dataset, ii) dividing FSpe by the maximum distance to the rest of the species pool in functional space across the whole dataset, iii) dividing FOri by the maximum nearest-neighbor distance observed across all species in the dataset. We used correlation analyses to assess relationships among traits and diversity indices (correlation analysis in Appendix S2 -D). Although some traits and all three indices covaried, we maintained all of them in our analyses because each trait and index represents a distinct aspect of the functional diversity of dung beetles.

| Dung beetle ecological function
To quantify dung beetle ecological function, we used a "function arena," which consisted of a 1-m diameter circular plot, delimited by a nylon fence (20-cm height), with 200 g of dung (80% human, 20% pig) deposited in the center . To calculate dung removal (i.e., the ecological function), we weighed the remaining mass of the dung after 24 hours of exposure in the function arena. We installed the arenas in 60 of the 106 forest transects between April and August 2010 (Table S1): 12 in undisturbed, 13 in logged, 5 in burned and 13 in logged-and-burned primary forests, and 17 in secondary forests ( Figure 1, Table S1). Per transect, we placed three function arenas, located at 0, 150, and 300 m. As dung removal was expressed as a proportion, we logit-transformed the data before the analysis.

| Response to forest disturbance
Before testing the responses of dung beetle communities to forest disturbance, we estimated the sample completeness in our forest classes by an analyzing sample coverage using the iNEXT package (Hsieh et al., 2016). To assess whether forest disturbance promotes local species loss and consequently functional erosion (diversity and function), we performed generalized linear mixed models with a negative binomial error distribution ("nb.glmer" function) for richness and abundance of dung beetles, and linear mixed models ("lmer" function) for FRic, FSpe, FOri, mean species rarity, and dung removal (as a measure of ecological function) using the packages "lme4" for mixed models (Bates et al., 2013) and "phia" for contrast of factors (post-hoc) analyses (De Rosario-Martinez, 2015). We ran separate models using forest type, time since last disturbance (for primary forests), or regeneration time (for secondary forests) as explanatory variables and all models included catchment as a random effect. We ran the models of functional indices using only those transects that had at least 70% species with measured traits (101 forest transects; Table S1). Finally, to assess the potential influence of estimated trait data on our results, we also ran extinction scenarios and models of functional indices using only measured data from the 37 transects sampled in 2016 (see Appendix S2 -B).

| Simulating species loss
We simulated scenarios of species loss to assess the consequences of possible extinctions on the functional structure of dung beetle communities. We ran simulations for extinction scenarios at a local (transects) and a regional scale (pool of species), using dung beetle communities from the undisturbed primary forest (12 transects), and assessing the outcomes of the scenarios from the change in the three functional indices. For the regional simulations, we assessed three scenarios: 1) "rarest first" in which we sequentially removed species from the pool, from the rarest species (lowest RI values) to the most common species (highest RI values), and recalculated the three indices after each removal; 2) "common first" in which we sequentially removed species from the most common to the rarest; 3) "null scenario" in which we randomly removed species from the pool by shuffling the order of species removal 1000 times. We then evaluated the level of functional erosion (the decline in the values of the three functional indices) for each scenario, comparing the outcome of the first two scenarios against the null scenario. TA B L E 1 Dung beetle functional traits used in the analyses with their related functional meaning and relationship with dung beetle ecological function

| RE SULTS
We

| Effects of forest disturbance on dung beetle community and ecological function
Across the 106 transects, we found little evidence that primary forest disturbance affected dung beetle taxonomic diversity, as all primary forest classes (i.e. undisturbed, burned, logged, logged-andburned) had similar dung beetle richness, abundance and mean RI. By contrast, secondary forests had significantly fewer individuals (χ 2 = 11.17, p = 0.024, n = 106), species (χ 2 = 26.42, p < 0.001, n = 106), and rare species (χ 2 = 13.21, p = 0.010, n = 106; Figure 2). Dung beetle richness, abundance, and mean RI were not influenced by time since last disturbance in primary forests or by regeneration time in secondary forests ( Figure S1, Tables SA1 and SA2 in Appendix S2).

Local dung beetle communities (communities within transects)
presented low values of functional richness (FRic: 4×10 −6 -0.03), functional specialization (FSpe: 0.24 -0.43) and functional originality (FOri: 0.01 -0.14), indicating high functional redundancy. Dung beetle functional richness was unaffected by primary forest disturbance, and largely mirrored the pattern of taxonomic richness, with similar values in the four primary forest classes, but lower values in secondary forests (χ 2 = 11.06, p = 0.025, n = 101; Figure 3a), although the FRic of burned and logged-and-burned primary forests were similar to those in secondary forests. Neither FSpe nor FOri differed among forest classes (Figure 3b,c). None of the three indices was influenced by time since last disturbance in primary forests, and only FRic increased with regeneration time in secondary forests (Appendix S2: Figure S2 and Table SA1 and SA2).
The main ecosystem function (dung removal) was not affected by the lower taxonomic or functional richness of dung beetle communities in secondary forests, as a similar proportion of dung was removed in all forest classes (χ 2 = 1.53, p = 0.81, n = 60, Figure 4).
Across all forest types, the proportion of dung removed ranged from 40.8% to 100%, with a mean of 74.2%. Dung removal was not influenced by time since last disturbance or regeneration time (Appendix S2: Figure S3, Tables SA1 and SA2).

| Effects of species loss on functional structure
At the regional scale (total pool of species), we found little evidence to support our hypothesis that the loss of rare species would disproportionately affect dung beetle community function. The values of functional indices in "rarest first" and "most common first" scenarios did not differ from those obtained under the null scenario of random species loss (Figure 5a, b and c), except for a greater decline in FRic and FSpe with ~30% and ~45% loss of the rarest species, F I G U R E 2 a) Richness, b) abundance, and c) mean Rarity Index of dung beetle communities in 106 transects along an Amazon forest disturbance gradient. Different letters represent statistical differences among forest classes at p < 0.05; black dots are outliers and lines inside boxplots represent median values. UF is primary undisturbed forest (n = 12), LF is primary logged forest (n = 25), BF is primary burned forest (n = 7), LBF is primary logged-and-burned forest (n = 23), and SF is secondary forest (n = 39)  Figure 5). However, at the local scale a 20% loss of the rarest dung beetle species resulted in a greater decline in FRic, FSpe, and FOri than the null scenario (Figure 5d, e and f). A 30% loss of the rarest species more than halved FRic, and the declines in FRic were also greater with the loss of rare species compared to the null scenario with up to 70% of total local species loss (Figure 5d). FSpe followed the same pattern as FRic (Figure 5e), whereas FOri decreased with 20 to 40% loss of the rarest species but was similar to the null scenario for 50 to 80% loss of the rarest species (Figure 6f). By contrast, the loss of the most common species led to an increase in FRic, FSpe, and FOri compared to the null model (Figure 5 d, e and f).
The simulations using measured functional traits only (i.e., excluding species for which we estimated traits) produced very similar results at the regional scale, except that none of the indices declined more than the null model when the rarest species were lost first (Appendix S2 -B: Figure S5 a, b and c). At the local scale, simulations using only measured traits produced different results from those obtained using species with estimated traits, with all three scenarios ("rarest first," "most common" first and null) showing similar responses for the three indices (Appendix S2 -B: Figure S5 d, e and f).

| DISCUSS ION
We found strong evidence that the loss of rare species will disproportionately affect dung beetle community functional structure at the local scale: our extinction scenarios demonstrated that 20% of rare species loss at the local scale would result in an erosion of functional structure (i.e., loss of functional richness, specialization, and originality). By contrast, we found little evidence that rare species contributed disproportionately to the functional structure of the species pool of dung beetles at the regional scale. Accordingly, our empirical data also revealed a remarkably little effect of primary forest disturbance on the functional structure of dung beetle communities. Thus, we propose that high functional redundancy at the regional scale offsets the impact of rare species losses and makes dung beetle communities functionally resistant to primary forest disturbance at local scales.

| Functional resistance to forest disturbance
The level of primary forest disturbance in our study did not substantially affect dung beetle diversity or functional metrics, as we detected no change in community structure or function in response to logging, burning, or time since last disturbance. A similar lack of response to primary forest disturbance was also found for ant species richness in the Brazilian Amazon . It is possible that high variability among sites masked the detection of changes, since the disturbance classes we used were broad and included sites with F I G U R E 3 a) Functional richness (FRic), b) specialization (FSpe), and c) originality (FOri) of dung beetle communities in 101 transects along an Amazon forest disturbance gradient. Different letters represent statistical differences among forest classes at p < 0.05; black dots are potential outliers and lines inside boxplots represent median values. UF is primary undisturbed forest (n = 12), LF is primary logged forest (n = 25), BF is primary burned forest (n = 7), LBF is primary logged-and-burned forest (n = 23), and SF is secondary forest (n = 34)

F I G U R E 4
Dung removal in a subset of 60 transects along an Amazonian forest disturbance gradient. Black dots are outliers and lines inside boxplots represent median values. UF is primary undisturbed forest (n = 12), LF is primary logged forest (n = 13), BF is primary burned forest (n = 5), LBF is primary logged-and-burned forest (n = 13), and SF is secondary forest (n = 17) Nonetheless, our extinction scenarios suggest that the extent of actual species loss in disturbed primary forests was indeed too low to result in a substantial erosion of dung beetle community functional structure: even the most disturbed primary forests (loggedand-burned) presented similar mean species richness compared to undisturbed primary forests (Figure 2b). Dung beetle communities are mainly composed of generalist species (Hanski & Cambefort, 1991) and previous studies have revealed functional redundancy in dung beetle communities in undisturbed forests (Beiroz et al., 2018), fragmented forests (Barragán et al., 2011), and across environmental gradients (Nunes et al., 2016). Shared traits across generalist species explain the low levels of functional originality (a measure of uniqueness) in our study, and suggest functional redundancy in dung beetle communities (Mouillot, Graham, et al., 2013).
Although our study demonstrates resistance of dung beetle community structure to primary forest disturbance, the lower functional richness, species richness, abundance, and number of rare species in secondary forests demonstrate that deforestation has a major impact on dung beetle community composition and functional trait diversity (Figures 2 and 3a). Secondary forests establish after forest clearance and subsequent abandonment, usually after some form of agricultural use . Therefore, the high variation in soil properties, vegetation, and mammal communities of secondary forests (Berenguer et al., 2014;Lennox et al., 2018;Parry et al., 2007) result in major differences in dung beetle communities (Solar et al., 2015). Furthermore, dung beetle communities in secondary forests need to re-establish after the forest starts to regenerate, which depends on species arrival (dispersal) and colonization in the new patches of forest through metacommunity processes. Nonetheless, the similar levels of dung removal, despite lower dung beetle abundance, species richness, and functional richness in secondary forests in comparison with primary forests, suggest that less diverse dung beetle communities can maintain functionality in these forests. F I G U R E 5 Simulations of regional (a-c) and local (d-e) dung beetle species extinction in undisturbed Brazilian Amazon Forest, showing the effects of species loss on functional richness (FRic, a and d), specialization (FSpe, b and e) and originality (FOri, c and f); scenarios were based on losing the rarest species first (solid black line) and losing the most common species first (dashed black line), compared to a null scenario of random species loss (solid grey line); mean values and confidence intervals based on 1000 random simulations (shading) are shown for undisturbed primary forests for the regional scenarios and error bars (standard error) are given for n = 12 transects for the local scenarios; n.s. denotes a nonsignificant difference compared to the null scenario at p < 0.05; note that figures e and f have different y axis scales Losing species randomly

| Species loss at different scales
Our simulated extinction scenarios provide further evidence of the high functional redundancy of dung beetle communities. However, we also demonstrate that the effect of species losses on functional structure is scale-dependent, whereby higher-level processes can at least temporarily offset losses at a local scale. At the regional scale, the functional structure of dung beetle communities barely differed among the three species-loss scenarios -rarest first, most common first, or random loss of species. It is noteworthy that the values of FOri hardly declined, even with 75% of species loss in all scenarios ( Figure 5), as this indicates that the regional species pool is functionally redundant and functional structure is highly resistant to species losses. Our results also imply that rare dung beetles are not necessarily highly specialized and consequently do not contribute unique traits or functions to the regional pool of species; this can be explained by the high nestedness of mammal-dung beetle networks (Bogoni et al., 2019;Raine et al., 2018), whereby common species feed in a wide range of mammal dung types, whereas rarer species feed in a subset of these dung types. Hence, as there is a relatively low level of specialization within the dung beetle community, there is a high probability that other species will share the same functional traits, regardless of whether rare or common species are lost from the community. As such, results from dung beetles may not reflect more functionally diverse invertebrate groups but the patterns observed in our extinction scenarios likely apply to broad ecosystem functions and other communities dominated by generalist taxa.
Despite the high resistance of community functional structure at the regional scale, we observed a greater erosion of functional structure with the loss of rare species at the local scale, which was a prediction of our hypothesis based on studies with other taxa (e.g., Leitão et al., 2016). Functional richness, specialization and originality declined more than expected based on the random loss scenario when 20% of the rarest species were lost. The rarest species are more vulnerable to extinctions because they have low local abundance, as well as limited geographical range and h (Davies et al., 2004;Harnik et al., 2012), and therefore our scenario predicting that rare species will be lost first is likely to be realistic. The simulated 20% rare species loss threshold at a local scale also explains why we found no significant effect of primary forest disturbance on dung beetle community structure and function across our field transects, as the overall decline in species richness relative to undisturbed forests was generally <20%. By contrast, dung beetle species richness in secondary forest transects was 16-68% lower than in undisturbed primary forests, and hence the lower values of functional richness in secondary forest sites are in line with the declines predicted in our extinction models. Indeed, for the range of species loss we observed in our field data in secondary forests, the random extinction scenario predicted a decline of 11-79% in FRic, and the rare species loss scenario predicted a decline of 12-85%, which is comparable to the measured decline in FRic (20-99%, Figures 3a and 5d).
Although we found no evidence for substantial loss of species in our primary disturbed forests, more intense disturbance, frequent logging (França et al., 2017), fires , and other types of forest degradation such as hunting (Nichols et al., 2013), can exacerbate species loss and compositional changes in dung beetle communities. Furthermore, dung beetle community structure and function could decline rapidly with lower levels of primary forest disturbance in fragmented landscapes with an eroded regional species pool. Under these scenarios, a local loss of 20% of rare species is plausible, which would lead to the erosion of functional structure and could jeopardize the ecological functions of dung beetle communities. Thus, our extinction models accurately predicted the functional structure of dung beetle communities in our disturbed and secondary forest transects, but additional field studies in severely degraded tropical forests are needed to assess the impacts of high extinction rates.
Functional redundancy at larger spatial scales likely stabilizes ecosystem functioning via species dispersal Pasari et al., 2013;Wang & Loreau, 2014) and dung beetles have great dispersal capability (da Silva & Hernández, 2015). Accordingly, communities from disturbed forests could be supplemented by immigration from nearby undisturbed forests through metacommunity dynamics, similar to processes after fires in open habitats (Brotons et al., 2005;Nunes et al., 2019). Hence, our study suggests that the functional redundancy at regional scales confers resistance to forest disturbance by buffering the effect of local species losses on community functional structure. By contrast, the "spatial insurance hypothesis" states that changes in community composition at small scales insure ecosystem functioning at larger scales (Wang & Loreau, 2014;Yachi & Loreau, 1999). Rather than contradicting the spatial insurance hypothesis, our results add to the theory by demonstrating that functional insurance could work both ways, whereby insurance against species losses at the local level can also be provided by the regional pool of species and traits, at least for generalist taxa that have good dispersal capabilities. It is conceivable that our extinction models could be adapted to other biological communities dominated by generalist taxa and that fulfil general ecosystem functions.
Consequently, maintaining a network of undisturbed ecosystems at regional scales could insure against local losses of other species and ecosystem functions.

ACK N OWLED G M ENTS
We are grateful to the following for financial support: Instituto