Question: Quantification of the effect of species traits on the assembly of communities is challenging from a statistical point of view. A key question is how species occurrence and abundance can be explained by the traits values of the species and the environmental values at the sites. Methods: Using a sites x species abundance table, a site x environment data table and a species x trait data table, we address this question by a novel Generalized linear mixed model (GLMM) approach. The GLMM overcomes the problem of pseudoreplication and heteroscedastic variance by including sites and species as random factors. The method is equally well applicable to presence-absence data as to count and multinomial data. We present a tiered forward selection approach for obtaining a parsimonious model and compare the results with the fourth corner method and RLQ ordination. Results: We illustrate the approach on a presence-absence version on two well-known data sets. In the Dune Meadow data species presence is parsimoniously explained by moisture and manure of the meadows in combination with seed mass and specific leaf area, respectively. In the Grazed Grassland data species presence is parsimoniously explained by the grazing intensity and soil phosphorous in combination with the C:N ratio and flowering mode, respectively. Conclusions: Our GLMM approach can be used to identify which species traits and environmental variables best explain the species distribution, and which traits are significantly correlated with environmental variables. The method is better suited for providing an interpretable and predictive model than the fourth corner method and RLQ.