The Evolution of Mammalian Sociality in an Ecological Perspective