sim_parabola {SimSurvey}R Documentation

Define a parabolic relationship

Description

Closure to be used in sim_distribution. Form is based on the bi-gaussian function described here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2993707/.

Usage

sim_parabola(
  alpha = 0,
  mu = 200,
  sigma = 70,
  sigma_right = NULL,
  log_space = FALSE,
  plot = FALSE
)

Arguments

alpha, mu, sigma

Parameters that control the shape of the parabola. Can be one value or a vector of equal length to the number of ages in the simulation (e.g. age-specific depth associations can be specified).

sigma_right

Optional parameter to impose asymmetry by supplying a sigma parameter for the right side. If used, sigma will be used to define the width of the left side. Ignored if NULL.

log_space

Should shape of the parabola be defined in log space? If TRUE, logged parameters are assumed to be supplied and x values used in the parabola equation are log transformed. This allows a more lognormal curve to be defined and, hence, allows a heavier tail and it forces very low values near zero.

plot

Produce a simple plot of the simulated values?

Value

Returns a function for use inside sim_distribution.

Examples


parabola_fun <- sim_parabola(mu = 50, sigma = 5, plot = TRUE)
parabola_fun(data.frame(depth = 0:100))

parabola_fun <- sim_parabola(mu = log(40), sigma = 0.5, log_space = FALSE, plot = TRUE)
parabola_fun(data.frame(depth = 0:100))

parabola_fun <- sim_parabola(mu = c(50, 120), sigma = c(5, 3), plot = TRUE)
parabola_fun(expand.grid(depth = 1:200, age = 1:2))


[Package SimSurvey version 0.1.6 Index]