These functions return a function to be used inside sim_distribution() to simulate spatially and temporally autocorrelated error.

sim_ays_covar(
  sd = 2.8,
  range = 300,
  lambda = 1,
  model = "matern",
  phi_age = 0.5,
  phi_year = 0.9,
  group_ages = 5:20,
  group_years = NULL
)

Arguments

sd

Variance (can be age-specific).

range

Decorrelation range.

lambda

Controls the degree of smoothness in the Matérn covariance process.

model

String indicating the correlation function to use: either "exponential" or "matern".

phi_age

Autocorrelation through ages. Can be a single value or a vector the same length as ages.

phi_year

Autocorrelation through years. Can be a single value or a vector the same length as years.

group_ages

A vector of ages to group together with shared space-age-year noise.

group_years

A vector of years to group together with shared space-age-year noise.

Value

A function to be passed to sim_distribution() as the ays_covar argument.