+10 XP

Mean, Variance, and Standard Deviation

Three numbers that characterize any noisy measurement:

python
import numpy as np

# Simulated firing rates (Hz) from a neuron
rates = np.array([12, 14, 11, 15, 13, 12, 14, 16, 11, 13])

# Mean — the average
mean_rate = np.mean(rates)  # or rates.mean()
# = (12+14+11+15+13+12+14+16+11+13) / 10 = 131 / 10 = 13.1 Hz

# Variance — average of squared deviations
# Variance = mean((x - mean)^2)
variance = np.var(rates)  # = 2.29

# Standard deviation — square root of variance (same units as data)
std_dev = np.std(rates)  # = sqrt(2.29) = 1.51 Hz

print(f'Mean firing rate: {mean_rate:.1f} Hz')
print(f'Standard deviation: {std_dev:.1f} Hz')
print(f'Firing rate: {mean_rate:.1f} ± {std_dev:.1f} Hz')

np.mean(), np.var(), np.std() are the three most important statistics functions.

Interpreting std dev:

For a normal distribution:
• Within 1 std dev of mean: ~68% of data
• Within 2 std dev: ~95% of data
• Within 3 std dev: ~99.7% of data

So if firing_rate = 13.1 ± 1.5 Hz, most of the time the neuron fires between 11.6 and 14.6 Hz. Occasionally (rare) it fires at 10 or 16 Hz.

In NMA, when they say 'population firing rate', they mean the mean ± std across neurons. This two-number summary is incredibly powerful.