Gravity Transformation

Note: We're happy to freely distribute the source code for our programs. Currently we use MATLAB (augmented, occasionally, with compiled code from other languages such as FORTRAN). For additional information or to request our source code, please send an email to

In this section we will describe the gravity transformation, which is used to simultaneously analyze large numbers of spike trains. We assume that you are familiar with the basic concepts of neural spike trains (as discussed in our Introduction and Background Material section) and crosscorrelation (discussed in the Crosscorrelation section).

If you're read the previous sections of this tutorial, you might wonder why we need yet another spike train analysis tool. Crosscorrelograms can be used to determine whether 2 spike trains are correlated, and the Joint Peristimulus Time Histogram (JPSTH) can be used to explore the dynamics of the correlation. What else do we need?

The gravity transformation is needed for several important reasons. One reason arises from simple combinatorics -- the number of pair-wise crosscorrelograms (or JPSTHs) needed to analyze more than just a few simultaneously recorded spike trains is extremely large. In general, n spike trains yield

n !

2 ! (n-2) !
different pairs, where n ! means n factorial. The number of pairs increases approximately as n squared; in fact, the formula above reduces to 0.5*n*(n-1). As an example, in order to completely analyze 30 simultaneously recorded neurons, you must make 30! / (2!28!) = 0.5*30*29 = 435 separate computations.

Another motivation for the gravity transformation is the question of interpretation of all those pair-wise computations. When you are able to record from significant numbers of neurons simultaneously, you'd like to be able to make some statements about the collective properties of the neurons, and pair-wise comparisons are difficult to interpret in terms of the group. Although pair-wise relationships are interesting and important discoveries, there's really not much reason to record from many cells simultaneously if all you're looking for is relationships between pairs of cells. (Of course, simultaneously recording many cells at a time will increase the chances of finding pair-wise relationships per recording.) Ideally you'd like to be able separate the recorded cells into functional groups, or "assemblies" -- i.e., groups of cells whose firing patterns are related. That's exactly what the gravity transformation does.

We should add that advances in technology are currently making large-scale simultaneously recordings attainable. Not too many years ago, simultaneous electrode recording of more than just a few neurons was a tour de force, but these days simultaneous recordings of up to 100 cells has been achieved, although such accomplishments are not exactly routine as yet.

Now that we've identified a need for the gravity transformation, we'll describe its properties. The gravity transformation is based on an analogy with the physics of interacting macroscopic particles, and takes its name from the particular interaction called gravity. The gravity transformation represents each recorded neuron as a freely moving "particle" which has a "charge", or attracting force, based on the spike train. When the neuron spikes, its corresponding particle receives an increment of charge, which decays over time. An attractive force exists between each pair of particles and is proportional to the product of their charges, acting along the (imaginary) line connecting them. Unlike gravity, however, the force is independent of distance. The total force acting on a particle is the vector sum of the pair-wise forces, and the total force is directly proportional to the velocity of the particle (not the acceleration, as it is with physical forces, such as gravity, in vacuo; we can think of the particles as being placed in a viscous medium, in which forces are proportional to velocity).

What we're looking for is aggregation of the particles. Initially, the particles are equidistant -- which requires a space with the same number of dimensions as particles. (For more than 3 particles, visualization of the results becomes a problem, as discussed below.) As the computation progresses, the charge function reflects the spike train dynamics, since each spike briefly elevates the corresponding particle's charge. The precise function of time that the charge assumes in response to a spike is fixed for each computational run, but it can be varied for different runs. What we expect is that particles which have charges that are correlated will tend to move closer together; this is because their charge functions are often large at the same time, so there is a significantly larger attractive force between these particles relative to the other particles. Consequently, clusters of particles may form, which represent assemblies of neurons whose spike trains possess above-average correlations.

There is a bit of a problem, however, in displaying the results. For n neurons, the calculation requires an n-dimensional space, and for n > 3 it's impossible to visualize this space. There are several approaches to deal with this problem: (1) plot the distances of all pairs of particles; (2) make a projection of the n-dimensional space onto a plane.

Figure 15 shows an example of the gravity transformation, plotting all pair distances. The horizontal axis is time, the vertical axis indicates the distance in arbitrary units. The data was taken from a simulation of 10 neurons, with a connectivity scheme that created 3 separate assemblies of 3 cells each and one neuron which was unrelated to any of the assemblies. (In this simulation, an assembly was produced by having one neuron provide common input to 2 other neurons, so the outputs of all 3 neurons are correlated.) The plot shows the distances of all pairs of particles, initialized arbitrarily to be 100 units. As time progresses, you see that the particles begin to separate, with clusters having similar distances. Remember that since we're plotting all distances between 10 cells, we have to deal with 0.5*10*9 = 45 different graphs, or "trajectories". By identifying which cell pair is represented by the trajectories (not indicated in the figure), we can discern which cells clustered together. For example, the 9 trajectories at the top are the pair-wise distances of the other cells with cell number 10, the cell which did not participate in any of the assemblies. The trajectories indicate that cell 10 and the other cells remained quite far apart, relative to other cell pairs; this means that the gravity transformation is correctly reporting that cell 10 did not participate in any of the assemblies. The middle 27 trajectories represent inter-assembly distances and the lowest 9 trajectories represent intra-assembly distances.

Figure 15

Figure 15

We can easily take a projection and present these results in 2 dimensions. (A 2-dimensional projection of a 3-dimensional figure is easily visualized -- think about shining a light on the figure with a flat screen in the background. The result will be a plane projection; distances along the perpendicular to the plane, of course, will be lost. The geometry behind 2-dimensional projections of n-dimensional objects is similar, although a bit more complicated.)

A 2-dimensional projection from the gravity transformation is shown in Figure 16 for the same simulation data as used above. In the beginning, the particles were separated by equal distances, but are now collected into groups based on the simulation's connectivity scheme. Note that the path of each particle is traced in the figure.

Figure 16

Figure 16

Of course, since we're using a projection, there could be a fortuitous alignment of particles, falsely indicating a close relationship. But use of different planes for the projection or comparison with plots of all cell pair distances will reveal the true state of affairs.

One thing to note is that, since the force is always attractive in the gravity transformation, if you run the calculation long enough virtually everything congregates together. Of course, the particles representing correlated neurons aggregate much more quickly than those that are uncorrelated; additionally, universal congregation can be prevented, if desired, by subtraction of the mean charge from each particle's charge function (the mean is a time average of the charge).

There are some interesting features of the gravity transformation which are quite different from both the crosscorrelogram and the JPSTH:

Kyle Kirkland

Back Home