extinctionCheck: Extinction check

View source: R/extinctionCheck.R

extinctionCheckR Documentation

Extinction check

Description

This function checks whether a population has gone quasi-extinct based on spawner abundances, generation length, and the extinction threshold.

Usage

extinctionCheck(y, gen, extinctThresh, spwnMat)

Arguments

y

A numeric representing the current year within the simulation (i.e. has a quasi-extinction occurred based on abundance in y-gen:y).

gen

A numeric representing generation length for the species being modeled.

extinctThresh

A numeric representing the assumed quasi-extinction threshold.

spwnMat

A matrix of spawner abundances with ncol = nCU and minimum nrow = gen.

Value

Returns a binary vector of length = ncol(spwnMat) with ones representing extinct stocks/CUs.

Examples

nCUs <- 5
gen <- 4
yr <- 6
sMat <- matrix(0, nrow = yr, ncol = nCUs)
for (i in 1:nCUs) {
  sMat[ , i] <- exp(rnorm(6, mean = 0.5, sd = 1))
}
sMat[ , 5] <- c(0.1, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001)
extinctionCheck(y = yr, gen = gen, extinctThresh = 0.001, spwnMat = sMat)

CamFreshwater/samSim documentation built on Sept. 25, 2023, 10:22 a.m.