View source: R/extinctionCheck.R
extinctionCheck | R Documentation |
This function checks whether a population has gone quasi-extinct based on spawner abundances, generation length, and the extinction threshold.
extinctionCheck(y, gen, extinctThresh, spwnMat)
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. |
Returns a binary vector of length = ncol(spwnMat) with ones representing extinct stocks/CUs.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.