Skip to contents

Distribution interval derived (DID) cutline method

Usage

density_int(
  dat,
  xvar,
  yvar,
  lower = NULL,
  upper = NULL,
  int_num = 25,
  log = FALSE,
  plot = FALSE
)

Arguments

dat

data frame or matrix containing the data

xvar

Name of column (or integer or double vector) containing measurements for the x-axis variable (e.g., carapace width).

yvar

Name of column (or integer or double vector) containing measurements for the y-axis variable (e.g., claw height).

lower

Integer or double; the lower bound for possible SM50 values. Must be on the same scale of the data. Defaults to the 20th percentile of the x-variable.

upper

Integer or double; the upper bound for possible SM50 values. Must be on the same scale as the data. Defaults to the 80th percentile of the x-variable.

int_num

Integer; how many intervals between the lower and upper bound should be used? Defaults to 25. With fewer intervals, each interval will contain more points, increasing the accuracy of the estimated density minimum for a given interval. However, the linear regression of the minima distributions (the divisions between immature and mature individuals within an interval) against the midpoints of those intervals may be more reliable with more intervals.

log

Boolean; should both variables be log-transformed before performing the regression? Defaults to FALSE.

plot

Boolean; should a plot of the data with the calculated minima and discriminating line be displayed?

Value

Something

Examples

set.seed(12)
fc <- fake_crustaceans(n = 1000, L50 = 100, allo_params = c(1, 0.2, 1.1, 0.2))
density_int(dat = fc, xvar = "x", yvar = "y", upper = 120)
#> Error in density_int(dat = fc, xvar = "x", yvar = "y", upper = 120): could not find function "density_int"
density_int(dat = fc, xvar = "x", yvar = "y", upper = log(120), log = TRUE)
#> Error in density_int(dat = fc, xvar = "x", yvar = "y", upper = log(120),     log = TRUE): could not find function "density_int"