Neural Coding · Lesson 3 of 3 · ~6 min

Rates need windows

Predict

The raster shows eight trials of the same neuron, every one at a true rate of $20$ Hz. You estimate the rate by counting spikes in a window and dividing by its length. Shrink the window from $1000$ ms to $50$ ms — the estimate gets steadier or noisier?

Hold that thought. Drag counting window down and keep your eye on the spread stat.
Try
Try itDrag counting window from $1000$ ms down to $200$, then to $50$. Watch the shaded window narrow, the per-trial counts in the right column, and the mean and spread stats underneath.
Notice

At $1000$ ms the eight trials count $27, 25, 28, 14, 21, 22, 17, 18$ spikes — the counts are the estimates, running from $14$ to $28$ Hz around a mean of $21.5$ Hz with spread $4.7$ Hz. At $200$ ms the counts drop to between $1$ and $8$ and the spread jumps to $12.5$ Hz. At $50$ ms the window holds $0$ to $3$ spikes, the only possible estimates are $0, 20, 40, 60$ Hz, the mean drifts to $27.5$ Hz, and the spread hits $17.1$ Hz. Even the full second never reads exactly $20$.

Explain

A firing rate is not something the raster displays — it is something you compute:

$$\hat{r} = \frac{n}{T}$$

spikes counted over a window. The counts vary from trial to trial even though the underlying rate never moves, and dividing by a small $T$ amplifies that variation: one extra spike shifts a $1000$ ms estimate by $1$ Hz but a $50$ ms estimate by $20$ Hz. Hence the trade-off. Long windows average the variability down and give steady numbers, but they would smear over any change in the true rate. Short windows could track change, but the granularity of whole spikes buries the signal. So a rate only means something once you say over what window — and the smooth instantaneous rates of lessons 1 and 2 were this chapter quietly assuming windows long enough for the noise to wash out.

About this model

What it represents: eight independent trials of a Poisson-like spike process at a constant $20$ Hz — intervals drawn as exponential waits from a seeded generator, so every reader sees the identical raster and can check the identical statistics.

What it leaves out: the variability model is itself a modeling choice, not a fact about neurons. Real spike trains show refractoriness (no two spikes arbitrarily close), bursting, slow drifts in excitability, and spike-count variance that can sit above or below the Poisson benchmark — treating spiking as Poisson is a decision this lesson makes openly, because it is the standard baseline against which those behaviors are measured.

Source: Gerstner, Kistler, Naud and Paninski, Neuronal Dynamics, Ch. 7.3 (EPFL, free online) — spike-train variability and the Poisson model's place in it.

Apply
Checkpoint — prove it to yourself

At the $50$ ms window, the per-trial estimates only ever take the values $0$, $20$, $40$ or $60$ Hz. Why?

The full-second window averages $21.5$ Hz, not $20.0$. What is the right conclusion?

Transfer: a stimulus makes the true rate switch every $100$ ms, and you must follow it. Which window do you take?

Key idea

$\hat{r} = n/T$ makes the window part of the measurement. Long $T$ buys steadiness and costs speed; short $T$ buys speed and costs a spread that grows to whole-spike steps. There is no windowless rate — every firing rate you meet carries a hidden $T$.

← All lessons