Two regions can have the same mean richness per site and still differ in how composition changes from one site to the next. In one, neighbouring sites share most of their species and composition changes gradually; in the other, adjacent plots hold almost disjoint species sets. This article measures that turnover on one simulated community in three ways: pairwise dissimilarity against distance, richness gained in a growing radius around focal points, and the number of species shared by several sites at once. Installation is covered in Get started; the plots need ggplot2. Whether the turnover found here departs from a randomised community is tested in Testing turnover against null models, and the split of turnover into replacement and nestedness components (Baselga 2010) is in Accumulating beta diversity.
Fit the decay of pairwise dissimilarity with distance using
betaDecay().Count the species within a growing radius around focal points using
distanceDecay().Follow the number of species shared by \(k\) sites using
zetaDiversity().
Example
Simulating a structured community
The simulated arena is a 100 by 100 unit square with 60 sites placed at random and 25 species. Each species has a centre, and its abundance at a site is drawn from a Poisson distribution whose mean falls off exponentially with distance from that centre: \(3 e^{-d/30}\) for a site \(d\) units away. The factor 3 sets the peak abundance near a centre and keeps per-site richness in a realistic range.
The decay scale of 30 units is the range parameter. It sets how broad each species’ patch is relative to the arena: a species is common near its centre and rare beyond about twice that distance. The data therefore contain spatial turnover, while the patches stay broad enough for sites to share species. With patches spanning roughly 30 to 60 units, turnover should be moderate and the decline of shared species should follow the geometric pattern of independent occurrences.
Simulation code
set.seed(123)
n_sites <- 60
coords <- data.frame(
x = runif(n_sites, 0, 100),
y = runif(n_sites, 0, 100)
)
n_species <- 25
species <- matrix(0, nrow = n_sites, ncol = n_species)
centers_x <- runif(n_species, 0, 100)
centers_y <- runif(n_species, 0, 100)
for (sp in seq_len(n_species)) {
dists <- sqrt((coords$x - centers_x[sp])^2 +
(coords$y - centers_y[sp])^2)
prob <- exp(-dists / 30)
species[, sp] <- rpois(n_sites, lambda = prob * 3)
}
colnames(species) <- paste0("sp", seq_len(n_species))species is a 60 by 25 matrix of abundances and
coords holds the site positions in columns x
and y. The number of species present per site:
Fitting distance decay of dissimilarity
Distance decay describes how compositional similarity falls off with separation. betaDecay() computes the Sorensen dissimilarity of every site pair, regresses it on geographic distance, fits an exponential, a power and a linear model, and selects among them by AIC (the models are written out in Decay models). The plot shows the pairwise cloud in grey, binned means in orange and the selected model in red.
The summary lists the distance and dissimilarity ranges, the coefficients and AIC of every fitted model, the AIC winner and the exponential half-life.
summary(decay)
#> $n_sites
#> [1] 60
#>
#> $n_pairs
#> [1] 1770
#>
#> $distance_range
#> [1] 2.133552 122.675695
#>
#> $dissimilarity_range
#> [1] 0.1351351 1.0000000
#>
#> $mean_dissimilarity
#> [1] 0.5569438
#>
#> $coefficients
#> model a b AIC
#> 1 exponential 0.6639603 0.008131671 -1925.419
#> 2 power 0.1844172 0.286615882 -1865.285
#> (Intercept) linear 0.3656503 0.003674776 -1943.935
#>
#> $best_model
#> [1] "linear"
#>
#> $half_life
#> [1] 85.24043
#>
#> $index
#> [1] "sorensen"The linear model has the lowest AIC on this dataset, so the curvature
of the decay is weak over the observed distance range.
coef() returns the intercept and slope of whichever model
AIC selected.
coef(decay)
#> a b
#> 0.365650265 0.003674776
decay$half_life
#> [1] 85.24043The linear slope is about 0.0037 dissimilarity units per distance unit: over the observed distances of 2 to 123 units, the predicted dissimilarity rises from about 0.37 to 0.82. The half-life of about 85 units comes from the exponential fit, which is computed even when the linear model wins. The similarity component would need roughly 85 distance units to halve. That is large relative to the 30-unit patch scale, because Sorensen dissimilarity saturates slowly when patches overlap. The half-life gives a scale and the AIC ranking gives a shape, so report both when curvature is shallow.
as.data.frame() returns the pairwise table
(distance, dissimilarity, site_i,
site_j) for your own models. index = "jaccard"
fits the same models to Jaccard dissimilarity.
Counting species around focal points
distanceDecay() answers
a cumulative question about the same data. It drops focal points onto
sites and counts how many species lie within a radius around each focal
point as that radius grows. It returns a spacc_decay object
whose y-axis is a species count, while betaDecay() returns
a spacc_beta_decay object of dissimilarities. Thirty focal
points give the confidence band.
dd <- distanceDecay(species, coords, n_seeds = 30, progress = FALSE,
seed = 1)
plot(dd)Cumulative richness climbs from about 11 species within the smallest
radius (2.5 units, the largest pairwise distance divided by the 50
default breaks) to the full pool of 25 once the radius spans the arena.
The steepness near the origin shows how quickly new species appear as
the neighbourhood grows. A region with strong turnover shows both a
steep betaDecay() slope and a steep rise here; a region
with weak turnover shows a shallow slope and a curve that reaches the
species pool only at large radii. Reporting both gives the rate of
compositional change and the rate of richness accrual from the same
data.
Following shared species across sites
Zeta diversity counts the species shared by more than two sites at
once. zetaDiversity()
samples sets of \(k\) sites and counts
the species present in all \(k\), for
\(k\) from 1 to 10. The default
method = "knn" draws each set as a random focal site plus
its \(k - 1\) nearest neighbours, which
targets spatial turnover; method = "random" draws random
sets and gives a non-spatial baseline. Fifty samples per order keep the
standard deviations narrow enough to read the trend.
zd <- zetaDiversity(species, coords, orders = 1:10, n_samples = 50,
progress = FALSE, seed = 1)
zd
#> Zeta Diversity: 60 sites, 25 species
#> Method: knn, 50 samples per order
#> ----------------------------------------
#> order zeta sd ratio
#> 1 11.60 3.86 NA
#> 2 6.38 3.42 0.550
#> 3 4.68 2.74 0.734
#> 4 4.00 2.29 0.855
#> 5 1.82 1.62 0.455
#> 6 1.16 1.27 0.637
#> 7 0.90 1.23 0.776
#> 8 0.56 0.86 0.622
#> 9 0.34 0.72 0.607
#> 10 0.46 0.68 1.353
#>
#> Decline model fits:
#> model r_squared aic
#> exponential 0.9674212 2.974648
#> power_law 0.9124907 12.855467
#> Best fit: exponential
plot(zd)The decline starts near \(\zeta_1 \approx 12\), the mean per-site richness, and falls steeply: by order 5 fewer than two species are shared by all five neighbours, and the count approaches zero by order 10. The band is one standard deviation across the sampled sets and is widest at low orders, where the per-set counts vary most.
The ratio of successive orders separates the two assembly regimes described in Zeta decline. A flat ratio points to exponential, stochastic decline; a ratio rising towards 1 points to power-law decline carried by a few widespread species.
plot(zd, type = "ratio")Up to order 9 the ratios stay between about 0.45 and 0.85 without an upward trend. The jump to 1.35 at order 10 compares two means below one species (0.34 and 0.46) and carries no information. The printed fits favour the exponential model by AIC (\(R^2 \approx 0.97\) against \(0.91\) for the power law). The simulation placed species independently with patchy but unstructured occurrences, so the turnover is closer to stochastic than niche-partitioned. A community with a few dominant generalists and many narrow specialists would push the ratios upward with order, because the generalists keep being shared while the specialists drop out. The absence of that climb is the evidence for stochastic turnover; the steepness of the decline alone is not.
as.data.frame() returns one row per order with the zeta
value, its standard deviation and the ratio.
zeta_tab <- as.data.frame(zd)
head(zeta_tab)
#> order zeta sd ratio
#> 1 1 11.60 3.862905 NA
#> 2 2 6.38 3.415989 0.5500000
#> 3 3 4.68 2.743750 0.7335423
#> 4 4 4.00 2.294625 0.8547009
#> 5 5 1.82 1.624933 0.4550000
#> 6 6 1.16 1.267490 0.6373626Decay models
Let \(S(d)\) be the similarity of two assemblages \(d\) units apart. The classic form is exponential (Nekola & White 1999; Soininen et al. 2007),
\[ S(d) = S_0 \, e^{-d/h}, \]
where \(S_0\) is the similarity at
zero distance and \(h\) is the
half-distance scale, the distance over which similarity drops by a
factor of \(e\). A small \(h\) marks steep turnover; a large \(h\) marks a community that stays
compositionally coherent across the region. In terms of dissimilarity
\(\beta = 1 - S\), the exponential
model betaDecay() fits is
\[ \beta(d) = 1 - a \, e^{-b d}, \]
with the half-life reported as \(d_{1/2} = \ln(2)/b\), the distance at which the similarity component \(a\,e^{-bd}\) reaches half its initial value. The power model \(\beta = a\,d^{b}\) implies scale-free turnover with no characteristic distance. The linear model \(\beta = a + b d\) is the least structured of the three and often wins when curvature is weak. Pairs at zero distance are left out of the fits.
The dissimilarity index shapes what the decay measures. Sorensen dissimilarity, the default, counts shared species twice in the denominator and so emphasises the species two assemblages have in common. Jaccard treats shared and unshared species symmetrically and reads as a stricter turnover measure. For a given pair of sites Sorensen never exceeds Jaccard, so a decay curve fitted to Jaccard sits higher and saturates sooner. Choose Sorensen when the analysis is about the overlap between assemblages and Jaccard when it is about the fraction of the combined species pool they fail to share. The half-distance changes with the index, so report the index alongside any decay parameter.
Two mechanisms generate distance decay, and the curve alone cannot tell them apart. Sites far apart tend to differ in climate, soil or habitat, so their species differ because their conditions differ. Under identical conditions, species can still fail to reach distant sites, so composition drifts with distance through dispersal limitation alone. Both produce a falling \(S(d)\). Separating them needs environmental covariates or the randomisations in Testing turnover against null models.
Zeta decline
For an order \(i\), \(\zeta_i\) is the mean number of species common to all \(i\) sites in a sampled set (Hui & McGeoch 2014). By construction \(\zeta_1\) is the mean per-site richness, \(\zeta_2\) is the mean number of species shared by a pair, and \(\zeta_i\) declines monotonically as \(i\) grows. The diagnostic is the ratio of successive orders,
\[ R_i = \frac{\zeta_i}{\zeta_{i-1}}. \]
A roughly constant ratio means \(\zeta_i\) follows a geometric (exponential)
sequence, \(\zeta_i \propto c^{\,i}\),
which arises when species occur independently with fixed probabilities.
That is the signature of stochastic, dispersal-driven turnover. A ratio
that climbs towards 1 with order means the decline follows a power law,
\(\zeta_i \propto i^{-\gamma}\), which
a few widespread generalists produce when they persist across many sites
while specialists drop out early. Power-law decline is read as evidence
of niche-based, deterministic assembly. zetaDiversity()
fits both forms to the non-zero zeta values on the log scale and reports
\(R^2\) and AIC for each.
The ratio is more informative than the raw curve because absolute zeta values confound richness with turnover. A species-rich and a species-poor region can share the same assembly mechanism yet show \(\zeta_i\) curves separated by a vertical shift, because \(\zeta_1\) differs. Dividing successive orders cancels that shift and isolates the rate of decline, the quantity assembly theory speaks to. The ratio of consecutive terms of a geometric sequence is constant by definition, so a ratio that departs from flat departs from the independent-occurrence model, and the direction of the departure points to the mechanism.
The two regimes also treat rarity differently. Under exponential
decline, rare species drop out of the shared set at the same
proportional rate as common ones, so no part of the species pool is
privileged. Under power-law decline, a small set of widespread species
dominates the high-order zeta values while the long tail of rare species
contributes only to \(\zeta_1\) and
\(\zeta_2\). Power-law turnover
therefore implies a structured pool with clear winners across the
region, the asymmetry that environmental filtering and competitive
sorting produce. Sampling knn neighbourhoods sharpens the
contrast with random sets, because nearest neighbours share the local
environment and any niche structure shows at lower orders.
Practical guidance
A turnover measure is only as informative as the turnover present in the sampling design. In the simulation above, a range parameter of 5 units would shrink each species to a tight cluster of sites: neighbouring plots would share almost nothing, distance decay would be steep and zeta would fall to zero by order 3. A range of 200 units would spread every species across the arena: sites would share most species regardless of separation, distance decay would be nearly flat and zeta would decline slowly. The value of 30 units sits between these extremes, where every measure has something to measure. A field design that samples too coarsely or too finely relative to the real patch scale flattens the signal in the same way.
Number of zeta samples. n_samples sets
how many \(k\)-site sets are drawn per
order. With 50 samples the standard deviations at low orders are wide;
500 to 1000 samples tighten the decline curve enough that the
exponential against power-law AIC comparison is stable. Below roughly
100 samples the ratio plot jitters and can show an upward trend that
vanishes with more sampling, so do not read the assembly mode off a
thinly sampled ratio.
Maximum zeta order. Set the top order no higher than the point where \(\zeta_i\) is still clearly above zero. Once shared counts reach zero the ratio is undefined and the fit gains nothing. A practical ceiling is the order at which \(\zeta_i\) drops below about 1, near order 6 to 8 on this dataset. Pushing to order 15 on 60 sites mostly adds zeros and noise.
Minimum sites and site pairs. Distance decay needs enough pairs to bin. With \(n\) sites there are \(n(n-1)/2\) pairs, so 30 sites give 435 pairs, a reasonable floor; below about 20 sites (190 pairs) the binned means become unstable. Zeta of order \(k\) needs many more than \(k\) sites to sample distinct sets; aim for at least \(5k\) sites at the top order.
| If the goal is to … | Use | Watch out for |
|---|---|---|
| Find a turnover distance scale |
betaDecay() half-life |
Shallow curvature: linear may win AIC; report the half-life anyway |
| Distinguish stochastic from niche turnover |
zetaDiversity() ratio |
Too few n_samples can produce an upward ratio |
| See richness grow with the neighbourhood | distanceDecay() |
A species count, not a dissimilarity, despite the name |
Distance decay is uninformative when sites span a narrow distance range, because the model then extrapolates a slope from a short arm of the curve; if the maximum pairwise distance is only a few times the minimum, skip it. Zeta diversity is the wrong tool when richness is so low that \(\zeta_2\) is already near zero, since every higher order is then a string of zeros with no shape to fit.
References
Baselga, A. (2010). Partitioning the turnover and nestedness components of beta diversity. Global Ecology and Biogeography, 19, 134-143.
Hui, C. & McGeoch, M.A. (2014). Zeta diversity as a concept and metric that unifies incidence-based biodiversity patterns. American Naturalist, 184, 684-694.
Nekola, J.C. & White, P.S. (1999). The distance decay of similarity in biogeography and ecology. Journal of Biogeography, 26, 867-878.
Soininen, J., McDonald, R. & Hillebrand, H. (2007). The distance decay of similarity in ecological communities. Ecography, 30, 3-12.