One way to analyze the relationship between species attributes (e.g. functional traits) and sample attributes (e.g. environmental variables) via the matrix of species composition is by calculating the community-weighted mean of species attributes (CWM) and relating it to sample attributes by correlation, regression, ANOVA etc. This weighted-mean approach is used in a number of ecological fields (e.g. functional and vegetation ecology, biogeography, hydrobiology or paleolimnology), and represents an alternative to other methods used to relate species and sample attributes via the species composition matrix such as the fourth-corner approach. The problem with the weighted-mean approach is that in certain cases it yields biased results in terms of both effect size and significance, and this bias is contingent upon the beta diversity of the species composition matrix. The reason is that CWM values calculated from samples of communities sharing some species are not independent from each other. This lack of independence influences the number of effective degrees of freedom, which is usually lower than the actual number of samples, and the difference further increases with decreasing beta diversity of the data set. Discrepancy between the number of effective degrees of freedom and the number of samples in analysis turns into biased effect sizes and an inflated Type I error rate in those cases where the significance of the relationship is tested by standard tests, a problem which is analogous to analysis of two spatially autocorrelated variables. Consequently, reported results of studies using rather homogeneous (although not necessarily small) compositional data sets may be overly optimistic, and results of studies based on data sets differing by their beta diversity are not directly comparable. Here, I introduce guidelines on how to decide in which situation the bias is actually a problem when interpreting results, recognizing that there are several types of species and sample attributes with different properties and that ecological hypotheses commonly tested by the weighted-mean approach fall into one of three broad categories. I also compare available analytical solutions accounting for the bias (namely modified permutation test and sequential permutation test using the fourth-corner statistic) and suggest rules for their use.