New statistical tools for analyzing the structure of animal groups