Recent developments in automated tracking allow uninterrupted,
high-resolution recording of animal trajectories, sometimes coupled with the
identification of stereotyped changes of body pose or other behaviors of
interest. Analysis and interpretation of such data represents a challenge: the
timing of animal behaviors may be stochastic and modulated by kinematic
variables, by the interaction with the environment or with the conspecifics
within the animal group, and dependent on internal cognitive or behavioral
state of the individual. Existing models for collective motion typically fail
to incorporate the discrete, stochastic, and internal-state-dependent aspects
of behavior, while models focusing on individual animal behavior typically
ignore the spatial aspects of the problem. Here we propose a probabilistic
modeling framework to address this gap. Each animal can switch stochastically
between different behavioral states, with each state resulting in a possibly
different law of motion through space. Switching rates for behavioral
transitions can depend in a very general way, which we seek to identify from
data, on the effects of the environment as well as the interaction between the
animals. We represent the switching dynamics as a Generalized Linear Model and
show that: (i) forward simulation of multiple interacting animals is possible
using a variant of the Gillespie's Stochastic Simulation Algorithm; (ii)
formulated properly, the maximum likelihood inference of switching rate
functions is tractably solvable by gradient descent; (iii) model selection can
be used to identify factors that modulate behavioral state switching and to
appropriately adjust model complexity to data. To illustrate our framework, we
apply it to two synthetic models of animal motion and to real zebrafish
tracking data.Comment: 26 pages, 11 figure