Abstract
Animal behaviors often are decomposable into discrete, stereotyped elements, well separated in time. In one model, such behaviors are triggered by specific commands; in the extreme case, the discreteness of behavior is traced to the discreteness of action potentials in the individual command neurons. Here, we use the crawling behavior of the nematode Caenorhabditis elegans to demonstrate the opposite view, in which discreteness, stereotypy, and long timescales emerge from the collective dynamics of the behavior itself. In previous work, we found that as C. elegans crawls, its body moves through a “shape space” in which four dimensions capture approximately 95% of the variance in body shape. Here we show that stochastic dynamics within this shape space predicts transitions between attractors corresponding to abrupt reversals in crawling direction. With no free parameters, our inferred stochastic dynamical system generates reversal timescales and stereotyped trajectories in close agreement with experimental observations. We use the stochastic dynamics to show that the noise amplitude decreases systematically with increasing time away from food, resulting in longer bouts of forward crawling and suggesting that worms can use noise to modify their locomotory behavior.
Keywords: motor behavior, stochastic transitions, adaptation
Many organisms, from bacteria to humans, exhibit discrete, stereotyped motor behaviors. A common model is that these behaviors are stereotyped because they are triggered by specific commands, and in some cases we can identify “command neurons” whose activity provides the trigger (1). In the extreme, discreteness and stereotypy of the behavior reduces to the discreteness and stereotypy of the action potentials generated by the command neurons, as with the escape behaviors in fish triggered by spiking of the Mauthner cell (2). But the stereotypy of spikes itself emerges from the continuous dynamics of currents, voltages, and ion channel populations (3, 4). Is it possible that, in more complex systems, stereotypy emerges not from the dynamics of single neurons, but from the dynamics of larger circuits of neurons, perhaps coupled to the mechanics of the behavior itself? Here we explore this question in the context of abrupt reversals in the crawling direction of the nematode Caenorhabditis elegans (5–7).
Reversal behaviors of C. elegans are particularly interesting as the underlying neural circuitry includes a nominal command neuron, AVA (8), whose activity is correlated with forward vs. backward crawling (9). On the other hand, AVA is an interneuron in a network, and it is unknown whether the decision to reverse direction can be traced to a single cell. Even when AVA is ablated, reversals occur, although the distribution of times spent in the backward crawling state shifts (7). Further, most neurons in C. elegans do not generate action potentials, so even if a single neuron dominates the decision it is not obvious why the trajectory of a reversal would be stereotyped. As a complement to probing further into the neural circuitry, here we step back and provide a more quantitative description of the reversal behavior itself.
Locomotion involves changes of body shape, and as C. elegans crawls, its body moves through a low-dimensional “shape space” in which four dimensions capture approximately 95% of the variance (10). Oscillatory motions along the first two modes correspond to the propulsive wave which passes along the worm’s body and drives it forward or backward. Indeed, the phase velocity of this oscillation predicts, quantitatively, the velocity of the worm’s centroid motion on an agar plate (11). As emphasized in Fig. 1, this shape-to-motion correspondence includes the fact that abrupt changes in the sign of the phase velocity predict the points where the worm suddenly backs up and reverses its crawling direction.
Fig. 1.
Reversals in shape space correspond to reversals in the crawling direction. (A) Tracking video microscopy gives both the x-y trajectory of the worm as it crawls on an agar plate, and the shape of the worm’s body at high resolution. (B) Shape is described by the tangent angle θ vs. arc length s, in intrinsic coordinates such that ∫dsθ(s) = 0. (C) We decompose θ(s) into four dominant modes. (D) The joint probability density of the first two modes. Amplitudes along the first two modes oscillate, with nearly constant amplitude but time varying phase ϕ = tan-1(a2/a1); here the amplitudes are normalized so that
. (E) The phase trajectories exhibit abrupt reversals, moments when ω ≡ dϕ/dt change sign. The red cross marks the onset of a body wave reversal and the green and magenta dots mark times prior to and during a reversal. These same times are also marked in A demonstrating that phase reversals correspond to reversals in the crawling direction.
Focusing on the phase dynamics ϕ(t), we construct equations of motion in best agreement with the observed trajectories (10); an inverse problem [see, e.g., (12, 13)]. Because the worm can crawl both forward and backward, the phase dynamic is minimally a second order system. Because the motions are noisy, we seek equations analogous to the Langevin equation for a Brownian particle subject to forces:
![]() |
[1] |
![]() |
[2] |
where m is the mass of the particle, f(x,v) describes the average forces acting on the particle, and ξ(t) is the random force resulting from molecular collisions. Thus we write for the phase of the worm’s shape oscillations
![]() |
[3] |
![]() |
[4] |
where 〈η(t)η(t′)〉 = δ(t - t′). Here we allow the possibility that, unlike a Brownian particle in equilibrium at a fixed temperature, the strength of the noise [σ(ω,ϕ)] varies with the state of the system. The results of this construction are shown in Fig. 2 A and B.
Fig. 2.
The Langevin model for the phase dynamics, Eqs. 3 and 4, reveals discrete attractors and noise-induced transitions between them. (A) The deterministic component of the force F(ω,ϕ), in units cycles/s2. The black lines are attracting limit cycles corresponding to forward and backward crawling, and the white dashed lines mark boundaries for our analysis of trajectories that start within the forward attractor. (B) The noise strength σ(ω,ϕ), in units cycles/s3/2. (C) A sample of the trajectories resulting from Eqs. 3 and 4, illustrating transitions between attractors at positive and negative ω, corresponding to forward and backward crawling.
The analysis of motor behavior through nonlinear dynamical systems has been applied in a wide variety of contexts, from human limb movement [(14), see also, e.g., (15) for a recent review] to gait transitions in animals (16). Although earlier work focused on the deterministic properties of dynamical systems such as bifurcations and attractors, the important role of noise in the motor system is also increasingly recognized, either as a limitation that the system must overcome (17, 18) or as an imprint of the inherent uncertainties in estimates of the input stimuli (19). In movement science, there is thus increased attention to learning stochastic dynamical systems from data (20). Our work expands these directions by using dynamical variables that are derived directly from low-dimensional projections of the full space of natural postures, by treating stochastic and deterministic features simultaneously, and by describing the motions of an entire organism—the scale on which many movement strategies operate.
The construction of the Langevin model requires only local features of the phase trajectory; we do not use, directly, any information about what happens on long timescales. Nonetheless, the model predicts a variety of phenomena that emerge on long timescales. As described in ref. 10, the underlying deterministic model (where we set σ = 0) has multiple attractors: limit cycles corresponding to forward and backward crawling and fixed points corresponding to pauses. In the full dynamics with noise, the system is predicted to remain near these attractors for extended periods of time. The noise drives random motions in the neighborhood of the attractors, as well as phase diffusion along the limit cycles; these are effects that we can think of as perturbations to the deterministic dynamics. There is also a nonperturbative effect: Noise drives sudden transitions from one attractor to another, as seen in Fig. 2C. In particular, there are transitions from the ω > 0 attractor to the ω < 0 attractor, and these correspond to reversals in the direction of crawling, as seen in Fig. 1A.
To quantify the predicted and observed reversals, we measure the survival probability in the forward crawling attractor. In the trajectory ϕ(t) we choose, at random, a moment in time where the phase velocity 0.1 < ω/2π < 0.6 cycles/s, a region indicated by the dashed white lines in Fig. 2A. Then we declare a reversal if the phase velocity falls below zero; the survival probability P(τ) is the probability that a reversal has not happened after a delay τ. Importantly, by focusing on the survival time within the forward state we remain agnostic about behaviors that may occur after the reversal [e.g., Ω-turns (5)] and this definition simplifies our interpretation. Also, the worm moves forward much more often than it moves backward and thus P(τ) is better sampled than any alternate measures.
If transitions are the result of brief events, well separated in time, then there should be no memory form one to the next, and we expect the survival probability to decay exponentially, P(τ) = exp(-τ/〈τ〉); this exponential decay is what we observe both in simulated trajectories and in the actual data, as shown in Fig. 3. In the data, the mean interval is 〈τ〉data = 16.3 ± 0.3 s, where the error is the bootstrap error within an ensemble of 33 worms, each observed for 35 min; this dataset is completely independent, with different individual worms, from that used in learning the Langevin model. The model predicts 〈τ〉theory = 15.7 ± 1.3 s, which agrees within 4% accuracy. We emphasize that the reversal events are emergent: There is nothing discrete about the phase time series ϕ(t), nor have we labeled the worm’s motion by subjective criteria.
Fig. 3.
Forward crawling survival times are well captured by noise-induced transitions in the model phase dynamics. (A) The distribution of survival times measured from worm data. We measure the probability that a worm’s trajectory, which is in the neighborhood of the forward attractor at time t, has not crossed to negative phase velocity by time t + τ. The decay is exponential, with a mean time 〈τ〉 = 16.3 ± 0.3 s. (B) The predicted mean time 〈τ〉theory as a function of the noise level. We scale the strength of the noise σ2 by a factor 1/β and solve Eqs. 3 and 4 for many noise realizations. The noise at β = 1 corresponds to the strength derived from actual worm motion and the average survival time at the measured noise level (〈τ〉theory = 15.7 ± 1.3 s) is in close agreement with worm data. In the low-noise limit (β≫1) we find 1/〈τ〉theory ∝ exp(-βE) (blue line), analogous to the Arrhenius temperature dependence of chemical reaction rates. Inset shows the region near β = 1 and the red point marks the measured 1/〈τ〉data. The red error bar denotes the bootstrap error in the noise strength, β = 1 ± 0.05.
The escape from one attractor to another under the influence of noise is like the escape of a molecule from one metastable configuration to another via Brownian motion—a chemical reaction (21). The strength of the noise, σ2 plays the role of temperature, and we expect that if the temperature changes we should see the Arrhenius law, as shown in Fig. 3B. The actual noise level is a bit too high for the Arrhenius law to be valid, but even with large noise, the mean time between reversals is still an order of magnitude longer than the characteristic times for motion within the forward crawling attractor, τosc = 1.90 ± 0.15 s. Also, when we estimate the noise level from the trajectories, there is an error in our estimate, and this error propagates to give an error in the predicted mean time between attractors, which is comparable to the deviation between the prediction and the data. We conclude that noise-driven escape from the forward crawling attractor provides a quantitatively accurate model for the observed rate of reversals, with no free parameters. Thus, the long time between reversals emerges from the interplay between the landscape of F(ω,ϕ) separating forward and reversal states and the strength of the noise, in the same way the long time between chemical reaction events emerges from the fast Brownian dynamics of the molecules.
In the theory of thermally activated escape over a barrier, the escape trajectories become stereotyped in the low-noise limit (22, 23). By analogy, we expect that the trajectories that allow the worm to escape from the forward crawling attractor should be clustered around some prototypical trajectories. Detailed analysis of the simulations show that there are in fact two such clusters, corresponding to transitions in which the sign of ω changes while the phase ϕ is positive or negative and this structure is also seen in the data. Focusing on the transitions that occur with negative phase, we align all the phase trajectories at the moment where ω changes sign, and estimate the probability distribution ρ(ϕ|t) at times t before the switch. As we see in Fig. 4, both the real data and the simulations show that this distribution is concentrated, and this pattern extends back for several seconds before the moment of the reversal itself. Indeed, comparing Fig. 4 A and B, we find that the conditional density derived from worm motion appears as a noisy version of the density derived from the theory.
Fig. 4.
The emergence of stereotyped behaviors in worm and model phase dynamics. (A) The conditional density ρ(ϕ|t) constructed from an ensemble of N = 469 worm trajectories aligned to exit the forward attractor at t = 0 via a path with ϕ(0) < 0. Color scale is for ln[ρ·(1 rad)]. (B) The same density generated from simulations of the stochastic model, Eqs. 3 and 4.
In wild-type C. elegans, the frequency of turning behaviors and reversals decreases with time away from resources, an adaptive effect resulting in greater dispersal of the trajectories (7, 24, 25). In our model, a change in the reversal behavior can be accomplished by a change in the deterministic dynamics, a change in the stochastic dynamics, or a combination of both. Over long timescales, we show that it is principally a decrease of the noise amplitude that accompanies the increased survival time whereas the deterministic dynamics is unchanged, Fig. 5 A and B. This result suggests that the worms can use noise to adaptive benefit. In detail, we divide long recordings into three 700 s epochs and fit the stochastic dynamical system, Eqs. 3 and 4, separately within each epoch. For each fit we then generate N = 104 trajectories with initial conditions in the forward crawling attractor and evolve until a phase reversal. We then compute the trial-averaged deterministic force and noise amplitude along these escape trajectories. In all three epochs, the stochastic model provides a good prediction of the mean forward survival time with
while
from early to late epochs, respectively. Note also that although the reversal rate decreases, the mean forward speed remains constant with
.
Fig. 5.
The changes in the stochastic dynamical system, Eqs. 3 and 4, as a consequence of increasing time away from food (A, B) and with genetic perturbations (C, D). (A) The mean deterministic force F(ϕ,ω) along escape trajectories derived from wild-type worms in early (black), middle (red), and late (blue) epochs. Units are cycles/s2 and differences among the three 700 s epochs are relatively small. Within each epoch we fit the stochastic model and generate N = 104 trajectories with initial conditions in the forward crawling attractor. As before, we evolve each trajectory until a phase reversal. The escape trajectories are aligned to the moment of the reversal (t = 0) and errors denote standard errors in the mean. (B) The mean noise amplitude σ2(ϕ,ω) along escape trajectories in early, middle and late epochs. Units are cycles2/s3. The mean noise amplitude systematically decreases resulting in longer times within the forward crawling state. (C, D) The mean deterministic force and noise amplitude derived from a goa-1 mutant during the early 700 s epoch. For comparison we also show the wild-type (N2) dynamics from the same early epoch. Befitting the general nature of the goa-1 gene, the mutant dynamics reveal substantial changes to both the deterministic force and the noise.
The form of the stochastic model encodes details of the signaling networks within C. elegans, which we can perturb with genetic manipulations. For comparison with wild-type behavior we include the analysis of goa-1(sa734), which contains a null mutation in the goa-1 gene that encodes a homologue to the Gα protein subunit in mammals. The mutation disrupts a variety of pathways connected to the G-protein family [see, e.g., (26)]. Among other phenotypes, these animals display hyperreversal behavior (27) with a substantially shorter mean survival time in the forward crawling state. Befitting its general nature, goa-1 is broadly expressed in the nervous system and, relative to wild type, we find both a different deterministic force and a different noise (Fig. 5 C and D). For the mean forward survival time the model prediction is 〈τ〉theory = 6.1 ± 0.4 s while 〈τ〉data = 4.1 ± 0.3 s.
To summarize, we constructed a model for the phase dynamics of C. elegans crawling by analyzing trajectories over very short timescales, essentially mapping the acceleration as a function of position and velocity in a simple phase space. But using this local description, we predict phenomena on much longer timescales. As with models of single neurons and small circuits, our model has multiple attractors, which we can identify with discrete behavioral states, and spontaneous transitions among these attractors. Because the transitions are driven by noise, the rate of transitions is suppressed exponentially relative to the natural timescales of the dynamics, in the same way that chemical reaction rates are exponentially slower than the timescales of small amplitude molecular motions. Indeed, this stochastic model of behavior suggests that the control of noise may be part of an overall movement strategy. We find that the reversal rates predicted by the model agree with experiment with an accuracy of 4%, within the errors of our estimates of the underlying noise levels. We also predict that the reversals occur via stereotyped trajectories, and these too agree with experiment. Rather than being traced to discrete commands, the stereotypy of reversals is an emergent property of the behavioral dynamics as a whole.
Materials and Methods
The experimental conditions, worm shape data and construction of the eigenworms were described previously (10, 11). Here we detail the construction of Langevin models from real data; see, for example, refs. 28 and 29. A central difficulty is not to overfit by allowing for arbitrarily complex functions describing the force. To regularize the learning problem we write the force as a polynomial in ω and a Fourier series in ϕ,
![]() |
[5] |
Then the parameters αmp are those which minimize
![]() |
[6] |
where the average is computed over the long trajectory. The optimal choice of the series orders P and M are found by fitting to 90% of the data and minimizing the generalization error computed on the remaining 10%; we find P = M = 5. Note also that the trajectories are given experimentally as discrete time samples and to minimize the impact of measurement errors we smooth the mode amplitudes a1(t) and a2(t) with fourth order polynomials before computing the phase. Finally, the noise strength is defined by
![]() |
[7] |
where the average now is taken over those moments in the data when the state of the system is characterized by particular values of ω and ϕ. We obtain similar results for the mean escape time and the stereotyped escape trajectories when σ(ω,ϕ) is averaged across states. Using these procedures the dynamical system (Eqs. 3 and 4, Fig. 2 A and B) was constructed by averaging five trajectories of length 125 s sampled at (Δt = 1/32 s) from each of twelve worms. To obtain enough reversal trajectories to adequately sample the escape time distribution (Fig. 3A) and the escape trajectory (Fig. 4A) we used a long (35 min) run from each of 32 worms sampled at (Δt = 1/4 s) under identical environmental conditions. The data underlying Fig. 5 was recorded from N = 11 wild type and N = 13 mutant worms, both imaged with time resolution Δt = 1/32 s. Each wild-type recording lasted 2,100 s whereas the mutants were recorded for 700 s and all recordings started approximately 5 min after the worms were removed from a bacteria-strewn agar plate. Both datasets were preprocessed as described previously (10).
Acknowledgments.
We thank T Mora and G Tkačik for discussions, and B Johnson-Kerner for help with the original experiments on which this analysis is based. This work was supported in part by National Institutes of Health Grants P50 GM071508 and R01 EY017210, National Science Foundation Grants PHY-0650617, PHY-0957573, and the Swartz Foundation.
Footnotes
The authors declare no conflict of interest.
*This Direct Submission article had a prearranged editor.
References
- 1.Bullock TH, Orkand R, Grinnell A. Introduction to Nervous Systems. San Francisco: WH Freeman; 1977. [Google Scholar]
- 2.Korn H, Faber DS. The Mauthner cell half a century later: A neurobiological model for decision making? Neuron. 1990;47:13–28. doi: 10.1016/j.neuron.2005.05.019. [DOI] [PubMed] [Google Scholar]
- 3.Hodgkin AL, Huxley AF. A quantitative description of membrane current and its application to conduction and excitation in nerve. J Physiol (London) 1952;117:500–544. doi: 10.1113/jphysiol.1952.sp004764. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Dayan P, Abbott LF. Theoretical Neuroscience: Computational and Mathematical Modeling of Neural Systems. Cambridge, MA: MIT Press; 2001. [Google Scholar]
- 5.Croll N. Components and patterns in the behavior of the nematode Caenorhabditis elegans. J Zool . 1975;176:159–176. [Google Scholar]
- 6.Zhao B, Khare P, Feldman L, Dent JA. Reversal frequency in Caenorhabditis elegans represents an integrated response to the state of the animal and its environment. J Neurosci. 2003;23:5319–5328. doi: 10.1523/JNEUROSCI.23-12-05319.2003. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Gray M, Hill JJ, Bargmann CI. A circuit for navigation in Caenorhabditis elegans. Proc Natl Acad Sci USA. 2005;102:3184–3191. doi: 10.1073/pnas.0409009101. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Chalfie M, et al. The neural circuit for touch sensitivity in Caenorhabditis elegans. J Neurosci. 1985;5:956–964. doi: 10.1523/JNEUROSCI.05-04-00956.1985. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Chronis N, Zimmer M, Bargmann CI. Microfluidics for in vivo imaging of neuronal and behavioral activity in Caenorhabditis elegans. Nat Methods. 2007;4:727–731. doi: 10.1038/nmeth1075. [DOI] [PubMed] [Google Scholar]
- 10.Stephens GJ, Johnson-Kerner B, Bialek W, Ryu WS. Dimensionality and dynamics in the behavior of C. elegans. PLoS Comput Biol. 2008;4:e1000028. doi: 10.1371/journal.pcbi.1000028. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Stephens GJ, Johnson-Kerner B, Bialek W, Ryu WS. From modes to movement in the behavior of C. elegans. PLoS One. 2010;5:e13914. doi: 10.1371/journal.pone.0013914. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Schmidt M, Lipson H. Distilling free-form natural laws from experimental data. Science. 2009;324:515–520. doi: 10.1126/science.1165893. [DOI] [PubMed] [Google Scholar]
- 13.Cructchfield JP, McNamara B. Equations of motion from a data series. Complex Syst. 1987;1:417–452. [Google Scholar]
- 14.Kelso JAS, Holt KG, Rubin P, Kugler PN. Patterns of human interlimb coordination emerge from nonlinear limit cycle oscillatory processes: Theory and data. J Mot Behav. 1981;13:226–261. [PubMed] [Google Scholar]
- 15.Huys R, Jirsa VK. Nonlinear Dynamics in Human Behavior. Berlin: Springer; 2010. [Google Scholar]
- 16.Collins JJ, Stewert IN. Coupled nonlinear oscillators and the symmetries of animal gaits. J Nonlinear Sci. 1993;3:349–392. [Google Scholar]
- 17.Harris CM, Wolpert DM. Signal-dependent noise determines motor planning. Nature. 1998;394:780–784. doi: 10.1038/29528. [DOI] [PubMed] [Google Scholar]
- 18.Todorov E, Jordan MI. Optimal feedback control as a theory of motor coordination. Nat Neurosci. 2002;5:1226–1235. doi: 10.1038/nn963. [DOI] [PubMed] [Google Scholar]
- 19.Osborne LC, Lisberger SG, Bialek W. A sensory source for motor variation. Nature. 2005;437:412–416. doi: 10.1038/nature03961. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.van Mourik AM, Daffertshofer A, Beek PJ. Deterministic and stochastic features of rhythmic human movement. Biol Cybern. 2005;94:233–244. doi: 10.1007/s00422-005-0041-9. [DOI] [PubMed] [Google Scholar]
- 21.Hänggi P, Talkner P, Borkovec M. Reaction-rate theory: Fifty years after Kramers. Rev Mod Phys. 1990;62:251–341. [Google Scholar]
- 22.Zinn-Justin J. Quantum Field Theory and Critical Phenomena. 4th Ed. Oxford: Oxford Univ Press; 2002. [Google Scholar]
- 23.Dykman MI, Mori E, Ross J, Hunt P. Large fluctuations and optimal paths in chemical kinetics. J Chem Phys. 1994;100:5735–5750. [Google Scholar]
- 24.Shingai R. Durations and frequencies of free locomotion in wild type and GABAergic mutants of C. elegans. Neurosci Res. 2000;38:71–83. doi: 10.1016/s0168-0102(00)00148-6. [DOI] [PubMed] [Google Scholar]
- 25.Sawin ER, Ranganathan R, Horvitz HR. C. elegans locomotory rate is modulated by the environment through a dopaminergic pathway and by experience through a serotonergic pathway. Neuron. 2000;26:619–631. doi: 10.1016/s0896-6273(00)81199-x. [DOI] [PubMed] [Google Scholar]
- 26.Bargmann CI, and Kaplan JM. Signal transduction in the C. elegans nervous system. Annu Rev Neurosci. 1998;21:279–308. doi: 10.1146/annurev.neuro.21.1.279. [DOI] [PubMed] [Google Scholar]
- 27.van Swinderen B, et al. Goα regulates volatile anesthetic action in C. elegans. Genetics. 2001;158:643–655. doi: 10.1093/genetics/158.2.643. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28.Racca E, Porporato A. Langevin equations from time series. Phys Rev E. 1999;71:027101–027103. doi: 10.1103/PhysRevE.71.027101. [DOI] [PubMed] [Google Scholar]
- 29.Friedrich R, Peinke J, Renner C. How to quantify deterministic and random influences on the statistics of the foreign exchange market. Phys Rev Lett. 2000;84:5224–5227. doi: 10.1103/PhysRevLett.84.5224. [DOI] [PubMed] [Google Scholar]












