sim_distribution: Simulate spatial and temporal distribution

View source: R/sim_dist.R

sim_distributionR 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 sim_abundance.

grid

A stars object defining the survey grid, like survey_grid or one produced by make_grid

ays_covar

Closure for simulating age-year-space covariance, like sim_ays_covar

depth_par

Closure for defining relationship between abundance and depth, like sim_parabola

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

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)



PaulRegular/surveyTestr documentation built on Sept. 21, 2023, 7:44 p.m.