Mechanisms underlying local functional and phylogenetic beta