extinctionCheck: Extinction check

Description Usage Arguments Value Examples

View source: R/extinctionCheck.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
8
9
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)

TESA-workshops/TESAsamSim documentation built on Feb. 6, 2021, 12:25 a.m.