2.3 Statistical analysis
To calculate statistical correlations and differences between populations at the 5% level of significance, we performed Kruskal-Wallis H and Wilcoxon rank tests for multiple groups, and Mann-Whitney U-tests for two groups, using R (R Core Team). We also compared numerical data of colour variable populations to non-variable conspecifics that are less constrained by population and / or habitat size. In our analyses, the dependent variable (genetic diversity) and independent variables (body size, population size, and level of habitat fragmentation) were compared. However, because the species included in our study are mainly found in three different taxonomic families, the data lacks independence, due to which we calculated the difference between variable and non-variable populations for each metric for each species, assuming that what happens within each species in terms of population divergence is independent of what is happening in other species. From this difference data for each species we calculated 95% Confidence Intervals (CI) with an independent T-test to determine whether the mean difference was different from zero. This was done for allelic richness, expected heterozygosity, and inbreeding coefficients. All significant correlations were visualized with ggplot2 in R (Wickham et al., 2016).
We also tested how body weight influenced colour variants in species with a phylogenetic generalized linear mixed models (PGLMMs), which estimates regression coefficients for binary and continuous data while incorporating interspecific relatedness (Ives & Halmus, 2011). A phylogeny and data frame of 70 carnivore species (Datafile S1) were adopted from Diniz-Filho & Tôrres (2002), to which colour variant presence / absence data were added (Datafile S2). We evaluated PGLMMs in ‘phyr’ 1.0.3 R package (Li et al., 2020), to test whether body weight (log-transformed) was associated with the presence of colour variants. Log transformation normalizes the strong right skew in metrics, which is recommended for comparative approaches (Ives & Garland, 2014). Because species only occur once as tips of the phylogeny, we used the pglmm_compare() function. Range size (log-transformed), and phylogenetic covariance were set as a random factor in our models, and results were presented with standard error (SE). We calculated R2 for PGLMM models using the package ‘rr2’ 1.0.2 (Ives, 2019).