2.4 | Statistical analyses
All statistical analyses and calculations were conducted in R (version 3.5.1, R Core Team, 2016). Tests for trait-environment relationships were performed using single and multiple ordinary least-squares regression models, with the average colour lightness and body size of Odonata assemblages as dependent variables and climatic variables as independent variables. Differences in the slopes of the relationships of colour lightness and body size with climatic variables between lentic and lotic habitats were determined by fitting interaction terms between the independent variables and habitat type. In all models, independent variables were scaled and centred (z-standardised) to facilitate their comparison. To ensure very low mulitcollinearity among predictors, the variance-inflation factors (vif) for the predictor variables in regression models were checked using the vif function of the R-package car (Table S2; Fox et al., 2016).
Since spatial autocorrelation in the survey data could violate the assumptions of our statistical models, i.e., that all data points are independent of each other, spatial correlograms of the model residuals were calculated using functions of the R-package ncf (Bjornstad, 2016). These correlograms indicated significant spatial autocorrelation in our data. Therefore, all analyses were repeated using spatial autoregressive error models (Dormann, 2007) that included a spatial distance weight according to the model-specific point of spatial independence (extracted from spatial correlograms shown in Figs S1-S2).