We used Drosophila melanogaster (Meigen, 1830) to root the tree and increase the depth of taxon sampling (Misof et al., 2014). Sequences were aligned for each region independently and later combined into a single supermatrix using Geneious version 7.1.4 (Kearse et al., 2012). We performed the Bayesian inference search using Mr. Bayes v3.1.2 (Ronquist and Huelsenbeck 2003), allowing the general time reversible (GTR) + ? model to be estimated, and using the default settings. We performed multiple runs to ensure that the resulting phylogeny was not stuck on a local optimum. We then created a time-calibrated phylogeny adopting fossil calibration points derived from Misof et al., (2014) using BEAST v1.8.2 (Drummond et al., 2012). We conducted simultaneous divergence-time and phylogenetic analyses using MCMC methods implemented in BEAST v1.8.2, which employs a lognormal relaxed-clock model to estimate divergence times.
2.6 Phylogenetic richness, divergence and structure
For each 1-km2 landscape we calculated six complementary abundance-based phylogenetic metrics (sensu Tucker et al., 2017). Two metrics are based on Hill numbers qD (T) of orders (i) 0 (0D) and (ii) 2 (2D) (Chao et al., 2010). qD(T) quantifies the effective number of linages as a function of evolutionary time, T (Chao et al., 2010). The parameter q refers to the value attributed to each node’s relative abundance (Chao et al., 2010). When q = 0, only species richness (presence/absence) is considered and T represents the age of the first node (Chao et al., 2010), indicating the phylogenetic richness of the community (Tucker et al., 2017). When q = 2 the metric is sensitive to species abundance and the mean effective number of very abundant linages is calculated (Chao et al., 2010), being considered a metric of phylogenetic divergence based on branch lengths (Tucker et al., 2017).
Two metrics of phylogenetic divergence based on pairwise phylogenetic distances (Tucker et al., 2017) were considered: (iii) the mean phylogenetic distance (MPD), which measures the average phylogenetic distance among all pairs of individuals in the community (including conspecifics); and (iv) the mean nearest taxon distance (MNTD), which does the same but the distance is measured to the closest non-conspecific relative (Webb et al., 2008). Both metrics are expressed in million years.
To assess the phylogenetic structure of each community (i.e. level of relatedness among co-occurring individuals), we considered: (v) the Net Relatedness Index (NRI), which is a calculation of the standardized effect size of MPD relative to a null model and indicates whether taxa in a sample are more phylogenetically clustered (positive NRI) or even (negative NRI) than expected at random; and (vi) the Nearest Taxon Index (NTI), which is the standardized effect size of MNTD and quantifies the extent of terminal clustering (e.g. intra familial clustering). Positive and negative values of NTI have the same interpretation of NRI (Webb et al., 2002).
2.7 Data analysis
Following Legendre et al., (2015), we assessed the spatial independence of our landscapes using distance-based Moran’s eigenvector maps (dbMEM) and the adespatial package (Dray et al., 2016) for R 3.2.0 (R Core Team 2016). This analysis uses geographical distance between sites to create orthogonal variables and then models eigenvectors with our response variables to assess spatial autocorrelation. The dbMEM eigenvalues are proportional to Moran’s I coefficient of spatial correlation and was obtained by 999 permutations (Legendre et al., 2015). We found no significant spatial autocorrelation in our response variables (0D: dbMEM R2 = 0.16; 2D: dbMEM R2 = 0.22, Species density: dbMEM R2 = 0.06; MPD: dbMEM R2 = 0.11; MNTD: dbMEM R2 = 0.09 NRI: dbMEM R2 = 0.14; NTI: dbMEM R2 = 0.13, P values ? 0.1 in all cases), so considered landscapes as independent samples (Table A4).
To evaluate the independent effect of forest cover, farmland heterogeneity and livestock intensification on species density and phylogenetic metrics (0D(T), 2D(T), MPD, MNTD, NRI and NTI we used generalized linear models (GLMs). Residual analysis from the models were checked under heteroscedasticity and non-normality assumptions to evaluate the adequacy of error distribution (Crawley 2013). To test if the forest cover, livestock intensification and farmland heterogeneity were correlated to each other, we assessed collinearity among predictor variables with the variance inflation factor (VIF) using the car package (Fox et al., 2016) available for R. All VIF values were lower than 2 (ranging from 1.80 to 1.84), suggesting independence (i.e. no collinearity) between predictors. We used the Akaike information criterion of second order corrected for small sample sizes (AICc) to select the more plausible model (?AICc ? 2; Burnham and Anderson 2002). After creating each model, we applied the “dredge” function in the package MuMln (Barton 2013) and the best model that with value ?AICc = 0.
Additionally, we tested for differences in response variables (0D(T), 2D(T), MPD, MNTD, NRI and NTI among management types using analyses of deviance (ANODE). To identify significant differences between land management types, we used post?hoc contrast tests (Crawley 2013) using the gmodels package (Warnes et al., 2009).
3.1 Dung beetle fauna
We recorded 169 332 dung beetles (64.2 ± 57.4 individuals per ha; mean ± SD) belonging to 33 species and 16 genera all in the subfamily Scarabaeinae (family Scarabaeidae) (Table A5). Almost half of the species (15 species, 45%) were exclusively recorded in forest areas, 13 species (39%) occurred in both forest and agricultural land, and five species (16%) were only recorded in intensified livestock production systems and maize farms (Table A5). Communities in more forested landscapes tended to be dominated by the genera Sisyphus, Uroxys and Deltochilum (Table A5). By contrast, communities in more managed landscapes tended to be dominated by Canthon, Onthophagus and Dichotomius (Table A5).
Overall, Canthon was the most abundant genus with 45% of individuals captured. Onthophagus and Deltochilum were the richest genera with 6 species (18% of species) and 4 species (12% of species) respectively. The most abundant species were Canthon indigaceus (27% of individuals sampled), Onthophagus landolti (19%) and Pseudocanthon perplexus (19%).