Attractor Dynamics

Introduction

In our post “Introduction to Temporal Dynamics and Change” we gave a look into the different types of change that exist. It became apparent that the predator-prey dataset, which has been used in multiple posts, showed a clear oscillatory pattern. Later in that post we mentioned that this oscillation led the different time-series to have stable states. Those stable states have an important meaning in Complex Systems.

In this post we will go deeper into what it means for a temporal pattern to demonstrate a stable state. These stable states are defined by multiple authors as attractors (Kelso, 1995; Abraham & Shaw, 1992; Butner et al., 2015).

In the following sections key concepts as the state space, vector field & phase portrait of a system, set point attractors and limit cycle attractors will be discussed. Furthermore, we will demonstrate in this post how to build a topological representation of an empirical dataset and to create a second-order change as outcome model which accurately represents the system in terms of a specific attractor dynamic. As always you can find all the R code, plots and predator-prey dataset being used on our GitHub page.

To take a look at what the time-series look like for the dataset being used, you can look at Figure 1. For the purpose of this post we will focus on the ‘sheep’ and ‘wolves’ time-series to analyse the concepts mentioned above.

Figure 1: Predator-prey full dataset

State Spaces & Topological Features

When evolving models for observed phenomena, often the best way to start is by creating a visualisation of the different values variables in the system can take. Often it is not possible to create a visualisation of all the different parameters, because it would quickly become computationally intractable. This brings us to the definition of a state space, which is a mathematical idealisation of all the possible states a system can take (Abraham & Shaw, 1992). The goal is to fill this state space with instantaneous velocity vectors (described below) to create a phase portrait, from which the dynamical system can be modelled and which can be used to predict future states from the current one.

You can think of this in multiple representations, but for now we’ll focus on the simple 2D Cartesian coordinate system. A point on that plot may represent the combination of values of two different parameters. When you measure multiple points over time you can draw out a trajectory on the state space, which represents the movement of the system over time.

From all the points of these trajectories it is possible to draw a vector indicating the direction and strength of the movement of the system between two time-points. By limiting this vector to an infinite-small time difference (that is, the strength and direction of the change in a time point), we can get the instantaneous velocity of the trajectory at different time points (Abraham & Shaw, 1992). As stated before, drawing all of these instantaneous velocities from the observed points uncovers the phase portrait. Since our data is discrete, but measured at every time-point, we can demonstrate this on the hand of a plot. In the following R code we plot the vector field of the ‘sheep’ and ‘wolves’ time-series, which is overlaid by a kernel density plot to see where most of the values occur. You can see the results in Figure 2.

Figure 2: 2D topology plot — sheep vs. wolves

In our dataset we have 2501 observations, which makes the plot quite messy and it will be difficult to take any inferences from it. That is why we run this again with some adjustments:

  • We sample the data at intervals of twenty. In “Introduction to Temporal Dynamics and Change” we explain how to ensure you find a correct sampling window. Twenty seems to still capture the important patters, but gives a clearer representation of the strength & change between time-points.
  • We want the vectors to demonstrate the strength, but over twenty time-points the vectors become very long. This is why instead of dividing them by two, we divide them by six to scale them to be shorter.

Again you can find the R code here and the plot in Figure 3.

Figure 3: 2D topology plot — sheep vs. wolves: sampled interval twenty

Figure 3 allows us to make some interesting inferences.

  1. Figure 3 is overlaid with the kernel density plot, we can see that there are three ‘basins’ in which most of the values occur (lines are lighter blue). Since the behaviour seems to cycle through these three basins we seem to be dealing with a limit cycle attractor. In a limit cycle attractor, the system rotates between certain values. As long as no strong perturbation occurs driving the system to a regime shift (more on regime shifts in “Properties of Dynamical Systems”), we expect the values do keep going through these basins.
  2. The vector length between the three basins are longer than the vector lengths close to/in the basins. This indicates that the strength of change is much larger between the three basins, which is important to take into consideration when analysing the correctness of our phase portrait.
  3. The vectors moving from high Sheep count, low Wolf count to low Sheep count, high Wolf count seem to be making an abrupt change at these high levels of Wolf count. Since there is a sharp corner, it may be difficult for this to be properly modelled in the phase portrait (Abraham & Shaw, 1992).

Before ending this section, we would like to explain another type of attractor, which is the set point attractor. Where the limit cycle attractor is a system which shows stability by looping through different states, a set point attractor shows stability by moving asymptotically towards a point on the state space (Abraham & Shaw, 1992).

Phase Portrait

Moving beyond the idea of plotting the vectors in the state space to create a vector field, we want to investigate whether we can specify equations which closely model the relationship between our two variables. Butner et al. (2015) shows how to use change as outcome regression in order to estimate a model which describes the topological features. In their example, they work with set point attractors (as described above) and repellers. Repellers are points from which the system moves away, and can thus be seen as the opposite of an attractor.

Multiple options are possible to create a phase portrait. For example, Kelso (1995) used the phase difference between two fingers wiggling to simplify the graphing process. According to Butner et al. (2015) another option would be to create a second-order model, but they indicate that it would still fail to depict the limit cycle.

A third approach is described in Perry et al. (2017). Here a system of two differential equations with the change score as outcome are used to model the dependence between partners. If done correctly, a cyclic pattern of vectors should appear in our phase portrait, following the distribution of our data-points. Part of the code used here was based on the code used by Perry et al. (2017).

Figure 4: Phase portrait — sheep vs. wolves time-series — basic model

Figure 4 plots the change as outcome plot for the two time-series. Looking at the direction of the vectors, it seems to be following the correct direction. Furthermore, the circular movements which could be found in Figure 3 are again visible in this plot.

The model specified in the code above Figure 4, may not be a model which accurately describes the data. When looking at the strength of the vectors, there does not seem to be large differences between the parts of the plot. Therefore, we use two methods to look for pieces of evidence to see if the linear models are specified correctly:

  • Visual inspection of the residual plot.
  • Ramsey RESET test (Ramsey, 1969), with the null hypothesis of correct specification.

Model Improvement

Below you can find the different transformations to the linear model being used and in Figure 5 you can see an overview of the RESET statistics, degrees of freedom used and the p-values.

Figure 5: Ramsey RESET test output

From the outputs of the Ramsey RESET test it is visible that the two models used for the phase portrait above are largely incorrectly specified. The RESET test seems to be sensitive to large numbers of data-points which makes it hard to reject the null hypothesis. The test output will still be used for determining the best model, as long as similar conclusions can be formed with the residual plots.

The best model to use for building the phase portrait would be model 2 for the sheep and model 1 for the wolves. It is important to note here that for the sheep model 2 is only marginally better than model 1, and for the wolves model 1 is only marginally better than model 3. Now the residual plots will be used for an analysis of the models. In Figure 6 the residual plot for the two basic models is plotted.

Figure 6: mod_sheepdiff (left) & mod_wolvesdiff (right) residual plots

From the bends at low fitted values and high fitted values in both plots it is visible that the model is incorrectly specified. This is a similar conclusion which could be taken from the output of the RESET test statistic & p-value. Therefore, different polynomial and moderation interactions will be added to investigate model improvements. The first transformation consists of adding a polynomial term of the other species (when predicting sheep difference, we add the wolves polynomial and vice versa). The plots can be seen in Figure 7.

Figure 7: mod1_sheepdiff (left) & mod1_wolvesdiff (right) residual plots

Whilst the bends for the ‘sheep’ model (left) seem to be largely changed in a (more or less) straight line, in the ‘wolves’ model (right) still some bends can be observed. Clearly, both residual plots are better and therefore these are at this moment the best models to use for building the phase portrait.

In the next step, for both values of ‘sheep’ and ‘wolves’ a polynomial term is added. The plots can be seen in Figure 8.

Figure 8: mod2_sheepdiff (left) & mod2_wolvesdiff (right) residual plots

From the residual plots of the models where both have polynomial terms for both ‘sheep’ and ‘wolves’ values, there seems to be no difference in lines. For the change in sheep model this can be read from the test statistic RESET test as well. For the ‘wolves’ time-series the test statistic from the RESET test is much larger which, in combination with the plot, gives enough evidence that these models do not represent our phase portrait better.

For the last model that will be investigated, next to the opposite polynomial, an interaction term is added. You can see the output in Figure 9.

Figure 9: mod3_sheepdiff (left) & mod3_wolvesdiff (right) residual plots

For the ‘sheep’ model we see a decrease in the straightness and fit of the line on the residual plot. Therefore, we can conclude that the best ‘sheep’ model observed so far is the model with the opposite polynomial term. For the ‘wolves’ model, a substantial improvement can be seen in this residual plot, since the line is much straighter around the 0 value for the residuals. Therefore, we conclude that this model will be used for creating the phase portrait. In the following code the best phase portrait according to our analysis here is plotted. You can see the final results of our phase portrait in Figure 10.

Figure 10: Phase portrait — sheep vs. wolves time-series — best model

In this last plot of the phase portrait you can see that the vector field describes our system quite well. As we mentioned before, the abrupt change in the upper left corner is not well displayed by our model since such a vector field assumes smoothness. The strength of the vectors are also more accurately depicted than in Figure 4, except for in the lower levels of wolves counts. Different transformations to the model could be done to improve the fit, however we believe it demonstrates an accurate representation of our system.

In the post “Phase Space Reconstruction” a method is given to reconstruct this phase space from one of the variables in the data-set, which can be used to supply the above analysis with data as well.

Conclusion

In this post methods for displaying attractor dynamics have been shortly explained, and have been used to investigate the attractor dynamics present in the predator-prey dataset. The system has shown to display a limit cycle as attractor dynamics, where the values cycle through 3 basins, with increasing velocity between the basins.

Also, a model has been built to display the phase portrait of the predator-prey ecosystem. We used an approach to additively build the best linear equations to display the model. In the end, an improved phase portrait could be observed and a rationale for how it was built was given.

This story was written by Malik Rigot, Ayrton Sambo & Niels Meulmeester, originally created as part of Travis J. Wiltshire’s Complex Systems Methods for Cognitive and Data Scientists course at Tilburg University.

References

Abraham, R., & Shaw, C. D. (1992). Basic Concepts of Dynamics. In Dynamics — the geometry of behavior (pp. 13–51). Addison-Wesley Longman.

Butner, J. E., Behrends, A. A., & Baucom, B. R. (2017). Mapping Co-regulation in social relations through exploratory topology analysis. Computational Social Psychology, 144–177. https://doi.org/10.4324/9781315173726-8

Kelso, J. A. (1995). Dynamic patterns: The self-organization of brain and behavior. MIT Press (MA).

Perry, N. S., Baucom, K. J., Bourne, S., Butner, J., Crenshaw, A. O., Hogan, J. N., Imel, Z. E., Wiltshire, T. J., & Baucom, B. R. (2017). Graphic methods for interpreting longitudinal dyadic patterns from repeated-measures actor–partner interdependence models. Journal of Family Psychology, 31(5), 592–603. https://doi.org/10.1037/fam0000293

Ramsey, J. B. (1969). Tests for specification errors in classical linear least-squares regression analysis. Journal of the Royal Statistical Society: Series B (Methodological), 31(2), 350–371. https://doi.org/10.1111/j.2517-6161.1969.tb00796.x

--

--