Studies on biodiversity and ecosystem functioning (BEF) have elicited debate over the interpretation of the positive relationship between species richness and plant productivity. Manipulating richness cannot be achieved without affecting composition; it is thus essential to consider the latter in statistical models.We firstly review existing approaches that use species richness as an explanatory variable and propose modifications to improve their performance. We use an original data set to illustrate the analyses. The classical method where composition is coded as a factor with a level for each different species mixture can be improved by defining the levels using clustering. Methods based on ordinations reduce the dimensionality of plant composition and use the new coordinates as fixed effects; they provide a much better fit to our observations.Secondly, we develop a new method where composition is included as a similarity matrix affecting the residual variance–covariance. Similarity in composition between plots is treated in the same way as shared evolutionary history between species in phylogenetic regression. We find that it outperforms the other models.We discuss the different approaches and suggest that our method is particularly suited for observational studies or for manipulative studies where plant diversity is not kept constant by weeding. By treating species composition in an intuitive and sensible way, it offers a valuable and powerful complement to existing models