sim_distribution {SimSurvey} | R Documentation |
Simulate spatial and temporal distribution
Description
Provided an abundance at age matrix and a survey grid to populate, this function applies correlated space, age and year error to simulate the distribution of the population. The ability to simulate distributions by length is yet to be implemented.
Usage
sim_distribution(
sim,
grid = make_grid(),
ays_covar = sim_ays_covar(),
depth_par = sim_parabola()
)
Arguments
sim |
A list with ages, years and an abundance at age matrix like
produced by |
grid |
A stars object defining the survey grid, like |
ays_covar |
Closure for simulating age-year-space covariance,
like |
depth_par |
Closure for defining relationship between abundance and depth,
like |
Details
This function simulates the probability of simulated fish inhabiting a cell as a function of a parabolic relationship with depth and space, age, and year autocorrelated errors. WARNING: it make take a long time to simulate abundance in a large grid across many ages and years - start small first.
Value
Appends three objects to the sim
list:
grid
- A stars object with the grid detailsgrid_xy
- Grid details as a data.table in xyz formatsp_N
- A data.table with abundance split by age, year and cell
Examples
sim <- sim_abundance(ages = 1:5, years = 1:5) %>%
sim_distribution(grid = make_grid(res = c(20, 20)),
ays_covar = sim_ays_covar(phi_age = 0.8,
phi_year = 0.1),
depth_par = sim_parabola(mu = 200,
sigma = 50))
head(sim$sp_N)
head(sim$grid_xy)