Computational Neuroscience – 8 spike trains
Introduction
These notes are about the analysis of spike trains. It is based on Dayan & Abbott, sections
1.2, 1.4 & 3.2. There is also a set of slides that go with this lecture containing pictures showing
examples from the literature where these methods have been used.
Decoding spike trains
There are diverse methods for examining spike trains and describing or decoding their activity;
they are all useful in different ways and unsatisfactory in others. The methods we will look at
here will typically involve histograms, that is, some sort of discretization of time and binning
of results; this is typical of the field.
Peristimulus time histogram and spike triggered average
The idea here is to look at the activity immediately after a stimulus, so the stimulus is repeated
as many times as is possible and the spikes that occur different amounts of time after the
stimulus are binned together. Thus, a trial refers to the responses to a single presentation of
the stimulus and
• Superimpose the trials with the stimulus times superposed.
• Divide time into small intervals or bins.
• Plot the spike count in each bin.
This is illustrated in Fig. 1.
A related idea is the spike triggered average, this is used when there is a continuous stimulus,
such as the current level used to stimulate an electric fish, and the spike triggered average
shows the average value of the stimulus at different amounts of time before a spike. The spike
triggered average can be interpreted in terms of the sort of linear model we discussed in the
case of vision. More precisely, if there is a time dependent stimulus s(t) and the N spikes at
times ti then the spike triggered average is
S(τ) =
1
N
N∑
i=1
s(ti − τ) (1)
In other words it gives the average amount of stimulus a time τ before a spike.
Autocorrelogram
This shows how the behavior of a spike train is related to its behavior at a different time; it is
used to detect periodic behavior in spike trains: a periodic spike train will have gaps between
spikes related to the period. To work out the autocorrelogram
• Divide time into small bins, of length δt say.
• Count how many spikes are separated by a time between nδt and (n+1)δt and put them
in the nth bin.
• Plot the histogram.
This is illustrated in Fig. 2.
1
Computational Neuroscience – 8 spike trains
a
0 100 200 300 400 500
t (ms)
b
0 20 40 60 80
δt (ms)
0
2
4
6
Figure 1: Peristimulus time histogram. a represents a spike train and stimulus, with the tall
lines marking the stimulus and the short ones the spikes. b is the peristimulus time
histogram with bin size 10 ms, we see that two spikes came within 10 ms of stimulus
and five between 10 and 20 ms.
a
0 50 100 150 200
t (ms)
b
-80 -60 -40 -20 0 20 40 60 80
δt (ms)
0
2
4
6
8
Figure 2: Autocorrelogram. a represents a spike train and b is the autocorrelogram. All spikes
are a time distance of zero from themselves, so the central spike corresponds to the
six spikes themselves. The two for δt = 10 ms tells us that there are two spikes
that are one apart. This spike train is roughly periodic and that is matched by the
behavior of the autocorrelogram where there are more spike pairs a distance 50 ms
apart than, say 30 ms apart.
2
Computational Neuroscience – 8 spike trains
a
0 50 100 150 200
t (ms)
b
-80 -60 -40 -20 0 20 40 60 80
δt (ms)
0
2
4
Figure 3: Cross corellogram. a represents two spike train, one blue with spikes at 30, 90,
150, 160 and one yellow with spikes at 50, 110, 120, 170, 180 and 190. b is the
crosscorrelogram. These spike trains are both periodic in the same way, which shows
up as the repeating bumps in the cross-correlogram and one fires just before the
other, so, for example, the four in the 20 ms bin corresponds to the four yellow
spikes that occur between 20 and 30 ms after a blue spike. This could indicate that
one neuron is causing the other to fire, or that they are responding to the same
overall periodicity, but with different lags.
Cross correlogram
A cross correlogram is useful for measuring the relationship between the spiking in two neurons;
it might give an indication that one neuron may be influential in causing the other to spike
or it might show that both neurons are entrained to the same periodic behavior. It is like
the auto-correlogram except that it is gaps between spikes from different spike trains that are
measured and plotted. To work out the cross correlogram
• Divide time into small bins, of length δt say.
• Count how many spikes from neuron two are found between nδt and (n+ 1)δt compared
to the a spike from neuron one.
• Plot the histogram.
This is illustrated in Fig. 3.
Tuning curve
The tuning curve is used to related the response to a family of stimuli parameterized by a
single variable, such as the angle of a bar for vision. The tuning curve is a plot of the firing
rate against the parameter, so r(θ) for angle in vision.
3
Computational Neuroscience – 8 spike trains
Decoding a single neuron
Consider an experiment in which a monkey is shown a screen full of moving dots, some move
randomly but some move coherently to either the left or right. The monkey is trained to move
its eyes to the left if the dots are moving that way and to right if that’s the way the dots
are moving. If the monkey gets its detemination correct it gets a treat, probably juice. The
experimenter can control the coherence of the dots, at one extreme there is no movement one
way or another, all the dots move randomly; at the other extreme all the dots are moving the
same way.
Britten et al. [1] managed to record from a direction selective neuron in the monkey brain.
Such a neuron has a prefered direction. If the dots were moving the neurons preferred direction
it has a high firing rate, if they weren’t, it has a low one. However, in this noisy situation the
firing rate varied from trial-to-trial, the main thing is that the average is higher for trials in the
preferred direction to the other direction. In short, it looks like there are two normal curves,
one corresponding to the preferred direction, the other to the other; these curves overlap and
overlap more and more as the coherence is lowered, making the motion more random.
One way of describing how different the two distributions are is to use d′. If µ1 is the average
firing rate in the unpreferred direction and µ2 in the preferred direction and assuming both
distributions have the same variance, then
d′ =
µ2 − µ1
σ
(2)
This is illustrated in Fig. 4.
As an example, imagine that when the dots move left the firing rates are {15, 20, 25} and
when they move right they are {24, 30, 36}. Hence
µ1 =
15 + 20 + 25
3
= 20 (3)
and
µ2 =
24 + 30 + 36
3
= 30 (4)
Now, these data don’t have the same variances, so we assume the underlying distributions have
the same variance and we average to estimate this variance, so, using the unbiased estimator
of the population average
σ2 =
∑
i(xi − µ)
2
n− 1
(5)
where there are n data points {x1, x2, . . . , xn}, we get
σ21 =
52 + 52
2
= 25 (6)
and
σ22 =
62 + 62
2
= 36 (7)
hence σ2 = 30.5. So
d′ =
30− 20
√
30.5
= 1.81 (8)
This situation can be examined from the point-of-view of an ideal observer, one who can’t
see the dots, but can see the firing rate of two neurons, these are imagined as identical neurons
4
Computational Neuroscience – 8 spike trains
Figure 4: Two different responses from an MT neuron. The green curve corresponds to the
distribution of firing rate responses for the preferred direction, the red curve for the
other one. d′ measures how different they are; it is basically the distance between the
two means measured in units of the variance. [This figure was copied from Rafal’s
original slides.]
except one prefers left and the other prefers right. How well would this ideal observer do trying
to guess which way the dots are going? Imagine the distribution of firing rates are normal so,
say for the cell preferring left if the dots are moving left the firing rate is chosen randomly from
N (µ2, σ) and if the dots are moving right the firing rate is from N (µ1, σ). The other neuron,
the one which prefers right, is the same, but the other way around. The idea observer has to
then guess the neuron with the higher firing rate is the one whose preferred direction is the
one the dots are moving in.
It is easy enough to calculate the chance the ideal observer would come to the correct
conclusion based on the firing rates, usually the correct neuron has a higher firing rate than
the rate for the other, incorrect, neuron. Lets say the dots are going left, the probability the
observer is correct is the probability that the number chosen from the right-preferring neuron
(r) is higher than the one from the left-preferring neuron (l). It is
P (correct) = P [(spikes from r neuron) > (spikes from l neuron)] (9)
or, putting in the distributions
P (correct) = P (N (µ+, σ) > N (µ−, σ)) (10)
which, using the rules governing normal distributions
P (correct) = P (N (µ+ − µ−,
√
2σ) > 0) (11)
and, again using the identities for normal distributions this means
P (correct) = P (N (0, 1) < µ+ − µ−√ 2σ ) (12) By some algebra it turns out P (correct) = Φ(d′/ √ 2) (13) 5 References where Φ(t) is the cumulative for the normal distribution: Φ(t) = ∫ t −∞ p(τ)dτ (14) where p(τ) = 1 √ 2π e−τ 2/2 (15) is the probability mass function for N (0, 1). It starts at zero, for low d′ where it is very hard to distinguish it is near a half, and rises to one for large d′, which is when you would expect it to be easy to distinguish. In fact, in the Britten et al. paper [1] they show that this curve matches the actual, observed, behavior curves for how often the monkey made mistakes. References [1] Britten KH, Shadlen MN, Newsome WT, Movshon JA (1992). The analysis of visual motion: a comparison of neuronal and psychophysical performance. The Journal of Neu- roscience, 12, 4745-4765. 6