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.

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 sim_abundance. A raster object defining the survey grid, like survey_grid or one produced by make_grid Closure for simulating age-year-space covariance, like sim_ays_covar Closure for defining relationship between abundance and depth, like sim_parabola

## Value

Appends three objects to the sim list:

• grid - RasterBrick with the grid details

• grid_xy - Grid details as a data.table in xyz format

• sp_N - A data.table with abundance split by age, year and cell

## 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.

## Examples

sim <- sim_abundance(ages = 1:10, years = 1:10) %>%
sim_distribution(grid = make_grid(res = c(10, 10)),
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)