# Distance density k_D(r) = 2*pi*r*f(r) for the 2D exponential location kernel.
# Sampling: the distance r ~ Gamma(shape = 2, scale = a).
kd_exp <- function(r, a) (r / a^2) * exp(-r / a) # per-distance density
f_area <- function(r, a) (1 / (2 * pi * a^2)) * exp(-r / a) # per-area location density
set.seed(101)
a_true <- 20 # location scale, in metres
n_seed <- 400
r <- rgamma(n_seed, shape = 2, scale = a_true) # observed distances
mean_r <- mean(r)
mode_kd <- a_true # mode of Gamma(2, a) is (shape - 1) * scale = aFitting dispersal kernels in R
Corrected 1 October 2026: the post said that a seed trap measures distances, and that trap counts show the peak of the distance density; a trap of fixed area samples the per-area density, so the ring factor belongs to distances recorded for every seed, which is what the post simulates and fits, and not to counts from equal-area traps. It also said the naive exponential puts most seeds right next to the source; it only makes that the commonest distance.
Corrected 27 September 2026: the opening section said that neither the mean distance nor the peak of the distance density equals the location scale; the peak does equal it, and only the mean (about twice the scale) differs.
A dispersal kernel is a probability density: where does a seed (or a spore, or a juvenile) end up relative to its source? Almost every question that follows from it (how fast a population spreads, how far genes travel, how connected two patches are) reads off that density. So the first practical task is to fit one to data, usually seed-trap counts (traps placed at known distances from a source, each catching some seeds) or the distance each seed travelled from a known source.
There is a trap hiding in that sentence, and it is geometric rather than statistical. The quantity you usually want is the location kernel: a density per unit area, describing how many seeds land on a small patch of ground at position \((x, y)\). A trap of fixed area at distance \(r\) catches seeds in proportion to the per-area density there, so counts from equal-area traps trace the location kernel directly. A distance recorded for every seed (or pooled over traps that cover whole rings around the source) measures something else: how far a seed travelled, ignoring direction. Those are two different densities, and confusing them biases everything downstream.
Two densities, one process
For an isotropic kernel (no preferred direction), the location density depends only on the distance \(r\) from the source. Call it \(f(r)\): seeds per unit area at distance \(r\). Because it is a density over the two-dimensional plane, it normalises with the area element, and the area of the thin ring at distance \(r\) grows with \(r\):
\[ \int_0^\infty f(r)\, 2\pi r \, dr = 1 . \]
The density of the distance itself is therefore not \(f(r)\). It is the location density times the circumference of the ring the seed could have landed on:
\[ k_D(r) = 2\pi r \, f(r) . \]
That factor of \(2\pi r\) is the whole story. It is zero at the source and grows linearly, so even when the per-area density \(f(r)\) falls monotonically from a peak at the source, the per-distance density \(k_D(r)\) starts at zero, rises, and only then falls. The distance histogram peaks away from the source not because seeds prefer to travel that far, but because there is more ground at that distance.
Take the two-dimensional exponential kernel, a standard choice. Its location density and the distance density it implies are
\[ f(r) = \frac{1}{2\pi a^2}\, e^{-r/a}, \qquad k_D(r) = \frac{r}{a^2}\, e^{-r/a}, \]
so the distances follow a Gamma distribution with shape 2 and scale \(a\). Let us simulate a seed rain from this kernel and look at both densities on the same axis.
The seeds travel a mean distance of 40.3 m, close to the kernel mean of \(2a\) = 40 m. The distance density peaks at 20 m, exactly one location-scale out. The mean distance, though, is about twice the location scale of 20 m, and that gap between the mean and the scale is where the confusion begins.
Fitting it, right and wrong
Now fit the kernel to the distances. The right way uses the distance density \(k_D(r)\), so the ring factor is built in. A common shortcut treats the distances as if they were exponentially distributed on their own, \((1/b)\,e^{-r/b}\), because “dispersal declines exponentially with distance” sounds reasonable. It is not reasonable: no kernel that is finite at the source can produce exponentially distributed distances, because the distance density carries the \(2\pi r\) factor and so is zero at the source. Fit both by maximum likelihood and compare.
# Correct: distances follow k_D(r) = (r/a^2) exp(-r/a), i.e. Gamma(shape 2, scale a).
nll_correct <- function(la) -sum(log(kd_exp(r, exp(la))))
a_hat <- exp(optimize(nll_correct, c(-5, 10))$minimum)
# Naive: treat distances as exponential with density (1/b) exp(-r/b).
nll_naive <- function(lb) -sum(dexp(r, rate = 1 / exp(lb), log = TRUE))
b_hat <- exp(optimize(nll_naive, c(-5, 10))$minimum)
ratio <- b_hat / a_hatThe correct fit recovers a location scale of 20.1 m, essentially the true 20 m. The naive fit reports 40.3 m, a factor of 2.00 too large. The reason is exact rather than a sampling accident: the maximum-likelihood scale of a Gamma with shape 2 is the sample mean divided by two, while the maximum-likelihood scale of an exponential is the sample mean itself. Ignore the ring factor and you double the scale, every time.
The scale is only half of it. The naive model also gets the shape wrong. Its density is monotone, so it claims the commonest distance is right next to the source and the number thins out steadily. The real distance density rises to a peak at 20 m. A reader who fits the exponential and plots it against the observed distances will see a curve that misses the hump entirely.
What to carry forward
A list of seed distances is not the dispersal kernel. Turning distances back into a kernel means dividing out the ring area, or equivalently fitting the distance density \(2\pi r\,f(r)\) rather than \(f(r)\). Skip that step and two things go wrong at once: the estimated scale is too large (exactly double for the exponential), and the estimated shape loses the geometric peak that any kernel finite at the source must show. Counts from equal-area traps need no such step, because each trap already samples the per-area density \(f(r)\).
The honest limit here is narrow but worth stating: fitting the right density recovers the scale cleanly when the kernel family is correct and the data cover the whole distance range. Neither assumption is safe. The exponential is a thin-tailed choice, and the next tutorial shows that swapping it for a fat-tailed kernel leaves the near-source fit almost unchanged while moving the far tail by orders of magnitude. That tail is where long-distance dispersal lives, and it is where a dispersal analysis is most fragile.
References
Cousens R, Dytham C, Law R 2008. Dispersal in Plants: A Population Perspective. Oxford University Press. ISBN 978-0-19-929911-9.
Nathan R, Klein E, Robledo-Arnuncio JJ, Revilla E 2012. In: Clobert J et al. (eds) Dispersal Ecology and Evolution, Oxford University Press, pp 187-210. ISBN 978-0-19-960889-8.
Bullock JM, Mallada Gonzalez L, Tamme R, Gotzenberger L, White SM, Partel M, Hooftman DAP 2017. Journal of Ecology 105(1):6-19 (10.1111/1365-2745.12666).