Researchers led by Tim Caro of the University of California, Davis, California State University's Theodore Stankowich and geographer Paul Haverkamp analyzed data of more than 181 species of carnivores to determine how animal defenses evolved over centuries.
They ran a comparison of every possible predator-prey combination, correcting for a variety of natural history factors, to create a potential risk value that estimates the strength of natural selection due to predation from birds and other mammals.
They found that noxious spraying was favored by animals that were nocturnal and mostly at risk from other animals, while sociality was favored by animals that were active during the day and potentially vulnerable to birds of prey.
Conversely, small carnivores like mongooses and meerkats usually are active during the day which puts them at risk from birds of prey. Living in a large social group means "more eyes on the sky" in daytime, when threats can be detected further away.
The social animals also use other defenses such as calling out a warning to other members of their group or even mobbing together to bite and scratch an intruder to drive it away.
The findings have been published online in the journal Evolution.