R/sim_dist_spde.R
sim_ays_covar_spde.Rd
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
)
Variance (can be age specific)
Decorrelation range
String indicating "barrier" or "spde" to generate Q with
Defines autocorrelation through ages. Can be one value or a vector of the same length as ages.
Defines autocorrelation through years. Can be one value or a vector of the same length as years.
Make space-age-year variance equal across these ages
Make space-age-year variance equal across these years
The mesh used to generate the precision matrix
the set of triangles in the barrier of the mesh for the barrier model
Returns a function for use in sim_distribution
.
# \donttest{
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")
}
# }