Simulates a stratified-random survey on a population produced by sim_distribution()
.
Supports optional catchability functions, sampling caps, and custom set locations.
sim_survey(
sim,
n_sims = 1,
q = sim_logistic(),
trawl_dim = c(1.5, 0.02),
resample_cells = FALSE,
binom_error = TRUE,
min_sets = 2,
set_den = 2/1000,
lengths_cap = 500,
ages_cap = 10,
age_sampling = "stratified",
age_length_group = 1,
age_space_group = "division",
custom_sets = NULL,
light = TRUE
)
A simulation object returned by sim_distribution()
.
Number of surveys to simulate.
Be cautious: large values may consume significant memory. Use sim_survey_parallel()
if many simulations are needed.
A closure (e.g., sim_logistic()
) for simulating catchability at age.
Returned values must range between 0 and 1.
Trawl width and distance (same units as the grid).
Logical. If TRUE
, allows grid cells to be resampled.
May introduce bias, as depletion is applied at the cell level.
Logical. Should binomial error be imposed?
If FALSE
, stratified estimates at older ages may be biased due to rounding zeros.
Minimum number of sets per stratum.
Set density (sets per grid unit squared).
Warning: May error if set_den
is high and resample_cells = FALSE
, because allocated sets may exceed available cells.
Maximum number of lengths measured per set.
Cap on the number of ages to sample, depending on age_sampling
type:
If "stratified"
: maximum per length bin (via age_length_group
) and per age_space_group
(e.g., "division"
, "strat"
).
If "random"
: maximum number of fish aged per set.
Type of age sampling strategy: "stratified"
(default) or "random"
.
Width of length bins for stratified age sampling. Ignored if age_sampling = "random"
.
Spatial scale for stratified age sampling.
Options: "division"
(default), "strat"
, or "set"
. Ignored if age_sampling = "random"
.
A data.table
of set locations (same structure as returned by sim_sets()
).
If NULL
, set locations are generated automatically.
Logical. If TRUE
, drops some objects from output to reduce memory footprint.
A list including:
Rounded simulation results
Set location details
Sampling results
Includes:
N
: true population
I
: individuals available to the survey
n
: individuals caught by the survey
# \donttest{
sim <- sim_abundance(ages = 1:5, years = 1:5) |>
sim_distribution(grid = make_grid(res = c(20, 20))) |>
sim_survey(n_sims = 5, q = sim_logistic(k = 2, x0 = 3))
plot_survey(sim, which_year = 3, which_sim = 1)
#> No trace type specified:
#> Based on info supplied, a 'scatter' trace seems appropriate.
#> Read more about this trace type -> https://plotly.com/r/reference/#scatter
# }