An accumulation curve averaged over random starting sites describes a region as a whole. Started from each site in turn, the same curve describes that site’s neighbourhood, and summarising each curve by a few numbers gives a map of where species accumulate fastest. This article computes such per-site maps for one simulated region, exports them to sf for a GIS workflow, maps how much each site contributes to the region’s narrow-ranged species, and follows richness along an expanding radius with the wavefront diagnostic. Installation is covered in Get started; the plots need ggplot2 and the export needs sf. The region-wide endemism curve is in Relating diversity to area, and the spatial scale of a mapped metric is partitioned in Partitioning spatial structure.
Compute per-site accumulation metrics with
spaccMetrics().Follow richness along an expanding radius with
spaccWavefront().
Example
Simulating range-size variation
The simulated region holds 80 sites scattered over a 100 by 100 unit
square and 40 species. Each species occupies a Gaussian neighbourhood
around a random centre: its occurrence probability at a site is \(e^{-s r^2}\), where \(r\) is the distance to the centre and \(s\) (spread) sets the range
size. The first 10 species use spread = 0.005, so their
occurrence probability halves about 12 units from the centre; these are
the narrow-ranged species, tight clusters confined to one part of the
map. The other 30 species use spread = 0.001, a
half-probability distance near 26 units, and appear across much of the
region.
Simulation code
set.seed(42)
n_sites <- 80
n_species <- 40
coords <- data.frame(
x = runif(n_sites, 0, 100),
y = runif(n_sites, 0, 100)
)
species <- matrix(0L, n_sites, n_species)
for (sp in seq_len(n_species)) {
cx <- runif(1, 10, 90)
cy <- runif(1, 10, 90)
spread <- if (sp <= 10) 0.005 else 0.001
prob <- exp(-spread * ((coords$x - cx)^2 + (coords$y - cy)^2))
species[, sp] <- rbinom(n_sites, 1, prob)
}
colnames(species) <- paste0("sp", seq_len(n_species))species is an 80 by 40 presence-absence matrix and
coords holds the site positions in columns x
and y. The number of species per site:
Computing per-site metrics
spaccMetrics() runs an accumulation curve starting from each site and reduces each curve to summary statistics, one row per site. Three metrics are requested here:
slope_10is the initial slope over the first 10 percent of sites.half_richnessis the number of sites needed to reach half the total species pool.aucis the area under the accumulation curve, normalised by its length.
slope_25, richness_75pct,
richness_90pct and final_richness are also
available.
met <- spaccMetrics(species, coords,
metrics = c("slope_10", "half_richness", "auc"),
progress = FALSE)
summary(met)
#> Metric summary:
#> slope_10: mean=1.63, sd=0.47, range=[0.64, 2.70]
#> half_richness: mean=9.21, sd=4.35, range=[2.00, 19.00]
#> auc: mean=32.68, sd=2.12, range=[29.10, 36.59]The per-site values are in met$metrics, a data frame
with the coordinates and one column per metric, ready to map or
join.
head(met$metrics[, c("site_id", "x", "y", "slope_10",
"half_richness", "auc")], 4)
#> site_id x y slope_10 half_richness auc
#> 1 1 91.48060 58.16040 1.321429 10 33.1875
#> 2 2 93.70754 15.79052 1.011905 9 33.5625
#> 3 3 28.61395 35.90283 2.511905 4 34.6125
#> 4 4 83.04476 64.56319 1.678571 7 32.5375Mapping hotspots
plot() draws one metric as a heatmap over the site
coordinates; type = "points" and
type = "histogram" give the other two views.
plot(met, metric = "slope_10", type = "heatmap")A steep initial slope marks a site whose neighbourhood adds species
fast, because many distinct species are packed nearby. A low
half_richness marks a site from which half the species pool
is reachable within a short accumulation. Ranking sites by slope or by
inverse half-richness turns these maps into a prioritisation layer whose
top entries are candidate priority areas.
The three metrics read different stages of the curve and need not agree. The slope reads the steepness at the origin and is sensitive to the immediate neighbours. Half-richness reads the middle, where the curve crosses the halfway mark and turnover slows. The AUC integrates the whole curve and rewards sites that accumulate quickly and reach a high plateau. A site can have a steep slope and a high half-richness if its rich neighbourhood is small and the curve then stalls. Comparing the maps of the three metrics shows whether hotspots are local peaks or extended rich zones, which matters when a reserve must enclose a contiguous area.
plot(met, metric = "half_richness", type = "heatmap")The correlations between the per-site values show how far the three rankings agree.
round(cor(met$metrics[, c("slope_10", "half_richness", "auc")]), 2)
#> slope_10 half_richness auc
#> slope_10 1.00 -0.41 0.31
#> half_richness -0.41 1.00 -0.87
#> auc 0.31 -0.87 1.00Half-richness and AUC rank the sites almost alike (a correlation of \(-0.87\): sites that reach half the pool quickly also have a large area under the curve). The initial slope agrees with both only weakly, so the immediate neighbourhood of a site says little about how its curve continues.
Exporting to sf
as_sf() converts the per-site
table to an sf point layer for a GIS workflow or for spatial joins
against habitat layers. crs sets the coordinate reference
system of the coordinates; 32631 here is an arbitrary projected system
for the simulated units.
Mapping irreplaceable sites
The accumulation metrics describe how fast species are gained around
a site. Which species a site holds is a separate question: a site that
carries species found at few other sites cannot be replaced by another
one. spaccEndemism() with
map = TRUE scores this with the endemism richness of Kier
et al. (2009). Every species counts as one range equivalent, shared
equally among the sites it occupies, and the endemism richness of a site
is the sum of the shares it holds: a species found only there adds 1, a
species found at ten sites adds 0.1.
end <- spaccEndemism(species, coords, n_seeds = 20, map = TRUE,
progress = FALSE, seed = 1)
ev <- end$site_values
summary(ev$endemism)
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> 0.0000 0.2663 0.5097 0.5000 0.6923 1.4856
sum(ev$endemism)
#> [1] 40The values add up to the 40 species of the region, so each one is the
number of species a site accounts for; the column
endemism_prop divides it by total richness. The per-site
table has the layout of met$metrics, and
plot(type = "map") and as_sf() work as for the
accumulation metrics.
plot(end, type = "map")
ev$richness <- rowSums(species)
head(ev[order(-ev$endemism), c("site_id", "x", "y", "richness", "endemism")], 5)
#> site_id x y richness endemism
#> 69 69 69.32048 29.36238 17 1.4856270
#> 38 38 20.76590 35.56660 10 1.2877305
#> 7 7 73.65883 23.37034 13 1.2320528
#> 18 18 11.74874 51.50633 11 1.1048483
#> 22 22 13.87102 21.71577 7 0.9034414
cor(ev$endemism, ev$richness)
#> [1] 0.8289048Endemism richness and site richness are correlated at 0.83, since a site with more species collects more shares. The ranking still differs from a richness ranking wherever the species of a site are narrow-ranged: the highest value, 1.49 range equivalents, is three times the median of 0.51, and one site with no species scores 0. The endemism curve over a growing area is in Relating diversity to area.
Following an expanding wavefront
spaccWavefront()
accumulates species inside a radius that expands from seed points. The
method comes from invasion biology (Shigesada & Kawasaki 1997),
where it describes the species an organism encounters as its range front
sweeps outward. As a diagnostic it shows how richness grows with
geographic reach, while the nearest-neighbour curve shows growth with
site count. The radius step dr defaults to the largest
pairwise distance divided by n_steps, so the front sweeps
the whole region in the requested number of increments.
wf <- spaccWavefront(species, coords, n_seeds = 20, n_steps = 40,
progress = FALSE, seed = 1)
wf
#> spacc wavefront: 80 sites, 40 species, 20 seeds
#> Radius: 0.00 to 124.00 (40 steps)
plot(wf)The curve rises steeply at small radii when seeds land in species-dense neighbourhoods and flattens as the front reaches sparse ground. A front that saturates early relative to its largest radius indicates a pool concentrated near the seeds. Here the front holds 25 of the 40 species at a radius of about 29 units 36 at 60 units and all 40 at the full extent of 124 units.
xaxis = "sites" plots the same expansion against the
number of sites included.
plot(wf, xaxis = "sites")The contrast between the two axes describes the sampling layout. A curve that climbs fast against radius but slowly against sites means each unit of distance brings in many sites, the signature of a dense, evenly covered network. A curve that is slow against radius and fast against sites marks a network with large gaps the front must cross before it reaches the next cluster.
Practical guidance
| Method | Minimum input | Comfortable input |
|---|---|---|
| Per-site metrics | 30 sites | 50 or more sites |
| Wavefront | 30 sites | 50 or more sites |
| Question | Function |
|---|---|
| Where are the accumulation hotspots? | spaccMetrics() |
| Which sites hold narrow-ranged species? | spaccEndemism(map = TRUE) |
| How does richness grow with geographic reach? | spaccWavefront() |
A metrics map can be tested against randomised communities: ses() accepts a
spacc_metrics object, computes one effect size per site for
the chosen metric and maps them with plot(type = "map") (Testing turnover against null models).
References
Kier, G., Kreft, H., Lee, T.M., et al. (2009). A global assessment of endemism and species richness across island and mainland regions. Proceedings of the National Academy of Sciences, 106, 9322-9327.
Shigesada, N. & Kawasaki, K. (1997). Biological Invasions: Theory and Practice. Oxford University Press.