Phylogenetic Generalized Linear Models
To test the effect of traits on the responses and population trend, the responses on each other, as well as the effect of responses on population trends, we applied Phylogenetic Generalized Least Squares (PGLS; Freckleton et al. 2002; also called Phylogenetic Generalized Linear Models; Symonds & Blomberg 2014) through thepgls function as implemented in the caper R-package (Orme 2018). The PGLS method is an extension to generalized least squares where the phylogenetic relationships of species are incorporated into the modeling framework via estimation of covariance in multispecies data. Related species cannot be considered independent from each other in neither their life history traits (Freckleton et al. 2002; Ives & Zhu 2006) nor in their responses to environmental change (Davieset al. 2013; Fei et al. 2017). Thus, any model residuals of closely related species would often be more similar than by chance, which requires modification to the estimated slopes and intercepts of the models (Revell 2010; Symonds & Blomberg 2014). To allow controlling for phylogenetic dependence, we constructed a phylogenetic tree for the 289 species based on the hypothesis derived by Pöyry et al. (2017) for Nordic Macrolepidoptera (available in the associated data: (https://github.com/MariaHallfors/LepidopteraShift). We measured the phylogenetic signal in our data which confirmed that controlling for phylogenetic relatedness in subsequent analyses was needed to account for phylogenetic non-independence of the species. For more details and description of multicollinearity checks and scaling of variables, see Text S4.