Skip to contents

Generates a simulated coral community composition by allocating aerial cover to species based on user-defined morphological ratios and a total coral cover estimate, optionally drawn from a beta distribution. Optionally plots species size distributions and assigned ratios.

Usage

simulate_community(
  setplot,
  size,
  ratio,
  ratiovar = 0.2,
  coralcover = NULL,
  distribution = "beta",
  alpha = 12,
  beta = 4,
  seed = NULL,
  quiet = TRUE,
  plot = FALSE,
  ...
)

Arguments

setplot

An sf polygon object representing the plot area (used to calculate total area).

size

A data frame with columns species and area_cm2 containing size distributions.

ratio

A named numeric vector with proportions assigned to each growth form (names must be: "Tabular", "Branching", "Corymbose", "Digitate", "Massive").

ratiovar

Numeric. Proportional noise added to each growthform's ratio. Default is 0.2.

coralcover

Numeric. Mean coral cover percentage (0–100). If distribution = "beta", this is the mean used to sample actual coral cover.

distribution

Character. If "beta", coral cover is sampled from a beta distribution. Set to NULL to use coralcover directly.

alpha

Shape parameter α for the beta distribution (default = 12).

beta

Shape parameter β for the beta distribution (default = 4).

seed

Optional. An integer seed for reproducible randomization.

quiet

verbose

plot

Logical. If TRUE, generates diagnostic plots of the simulation and distributions.

...

Additional arguments (currently ignored).

Value

A data frame (tibble) with columns species, growthform, ratio, cover, and aerial area per species in cm².

Examples

if (FALSE) { # \dontrun{
ratios <- c(Tabular = 0.2, Branching = 0.2, Corymbose = 0.2, Digitate = 0.2, Massive = 0.2)
simulate_community(setplot = my_sf_plot, size = coral_size_data, ratio = ratios, coralcover = 30)
} # }