Advanced Analysis Panel (rank/occupancy/SAR/decay/rarefaction + optional PPC)
Source:R/panel.R
generate_advanced_panel.Rd
Build a multi‑panel summary of key ecological diagnostics from a simulation run: rank–abundance (SAD), occupancy–abundance, species–area (accumulation), distance–decay, and per‑quadrat rarefaction curves. If the point‑process packages spatstat.geom and spatstat.explore are available, an additional row of point–process diagnostics is appended, showing Ripley’s K (border correction), \(L(r)-r\), and the pair‑correlation function \(g(r)\).
Arguments
- res
A list produced by the main simulator containing at least:
P
Parameter list (used for labels/themes if needed).
species_dist
An
sf
POINT layer of individuals with aspecies
column.abund_matrix
Site \(\times\) species abundance data frame (first column
site
).site_coords
Data frame with
site, x, y
for quadrat centroids.domain
An
sf
polygon/multipolygon of the study area (used for PPC window).
Value
A patchwork
object (a ggplot
layout). You can print it
or save it with ggplot2::ggsave()
.
Details
The optional point–process diagnostics are computed only when both
spatstat.geom (for spatial windows and point patterns) and
spatstat.explore (for summary functions such as Kest
and
pcf
) are installed. The domain is converted to a window (owin
)
using spatstat.geom::as.owin()
on the sf
polygon; the
individuals are converted to a ppp
with that window. We then compute:
Kest(ppp, correction = "border")
and plot the border‑corrected K.\(L(r) = \sqrt{K(r)/\pi}\) and \(L(r)-r\) (\(>0\) suggests clustering).
pcf(ppp)
as an estimate of the pair‑correlation \(g(r)\) (\(>1\) suggests clustering; \(<1\) inhibition).
If conversion to owin
/ppp
fails, the PPC row is omitted gracefully.
Examples
if (FALSE) { # \dontrun{
panel <- generate_advanced_panel(results_list)
ggplot2::ggsave("advanced_panel.png", panel, width = 12, height = 14, dpi = 300)
} # }