sim_ays_covar_spde function

Simulate age-year-space covariance using SPDE approach

Simulate age-year-space covariance using SPDE approach

Returns a function to use inside sim_distribution to generate the error term.

sim_ays_covar_spde( sd = 2.8, range = 300, model = "spde", phi_age = 0.5, phi_year = 0.9, group_ages = 5:20, group_years = NULL, mesh, barrier.triangles )

Arguments

  • sd: Variance (can be age specific)
  • range: Decorrelation range
  • model: String indicating "barrier" or "spde" to generate Q with
  • phi_age: Defines autocorrelation through ages. Can be one value or a vector of the same length as ages.
  • phi_year: Defines autocorrelation through years. Can be one value or a vector of the same length as years.
  • group_ages: Make space-age-year variance equal across these ages
  • group_years: Make space-age-year variance equal across these years
  • mesh: The mesh used to generate the precision matrix
  • barrier.triangles: the set of triangles in the barrier of the mesh for the barrier model

Returns

Returns a function for use in sim_distribution.

Examples

if (requireNamespace("INLA")) { ## Make a grid my_grid <- make_grid(res = c(10,10)) ## Make a mesh based off it my_mesh <- make_mesh(my_grid) sim <- sim_abundance(ages = 1:10, years = 1:10) %>% sim_distribution(grid = my_grid, ays_covar = sim_ays_covar_spde(phi_age = 0.8, phi_year = 0.1, model = "spde", mesh = my_mesh), depth_par = sim_parabola(mu = 200, sigma = 50)) plot_distribution(sim, ages = 1:5, years = 1:5, type = "heatmap") }