Skip to contents

This function simulates coral colony sizes per species using either a log-normal (rlnorm) or gamma (rgamma) distribution, based on the observed mean and standard deviation of colony widths in the input data. Each species will be sampled ndraws times.

Usage

simulate_coralsize(
  input = coralsize,
  distribution = "rlnorm",
  ndraws,
  plot = FALSE,
  seed = NULL
)

Arguments

input

A data frame with columns species and width. Default is coralsize.

distribution

Character string. Distribution type to simulate from. Supported options are "rlnorm" and "gamma".

ndraws

Integer. Number of simulated coral sizes per species.

plot

Logical. If TRUE, a histogram of simulated sizes is plotted by species.

seed

Optional integer. If provided, sets the random seed for reproducibility.

Value

A tibble with columns:

species

Factor indicating coral species

width

Simulated colony width values

area_cm2

Simulated colony area values (π × (width/2)²)