Description Usage Arguments Details Value See Also Examples
Constructs either a simulated age frequency table or individuals that follow a simulated age frequency table. The number of individuals at each age is determined from an initial cohort size and an instantaneous or annual mortality rate supplied by the user.
1 2 3 4 5 6 7 8 9 |
N0 |
A numeric representing the initial cohort size to be used in the simulations. |
A |
A numeric representing the annual mortality rate to be used in the simulations. |
Z |
A numeric representing the instantaneous mortality rate to be used
in the simulations. Will default to the value that corresponds to the user
supplied value for |
incl.zero |
A logical indicating whether age-0 should be included in the
ouptut ( |
max.age |
A numeric indicating the maximum age to use in the
simulations. If |
indivs |
A logical indicating whether the output result should be ages
assigned to individual fish ( |
rand |
A logical indicating whether the individual ages should be chosen
randomly ( |
The heart of this simulation is the assumption of an exponential decay model
that starts with N0
individuals at age-0 and estimates Nt individuals
at each age t, from 0 or 1 (depending on the incl.zero
value) to
max.age
, with Nt=N0*exp(-Zt). If indivs=FALSE
then the ages
(t) and frequencies (Nt) are output as a data frame. If indivs=TRUE
(default) and rand=FALSE
then the age frequency values are used to
deterministically produce ages for individual fish – i.e., essentially
rep(t,Nt)
. Finally, if indivs=TRUE
(default) and
rand=TRUE
(default) then the age frequency values are used to
stochastically produce ages for individual fish – i.e., essentially
sample(t,sum(Nt),replace=TRUE,prob=Nt/sum(Nt))
.
Either a data frame containing the ages and the simulated number of
fish at each age (i.e., when indivs=FALSE
) or a vector containing the
simulated ages for individual fish (i.e., when indivs=TRUE
; default).
simLenFromAge
, simLenSelectP
,
simLenSelectM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## set seed for repeatability
set.seed(5234734)
## Simulated individual ages (random)
bg.ages <- simAges(N0=500,A=0.35)
str(bg.ages)
table(bg.ages)
## Simulated age frequency (random)
bg.ages.sum <- simAges(N0=500,A=0.35,indivs=FALSE)
str(bg.ages.sum)
t(bg.ages.sum)
## Simulated individual ages (non-random)
bg.ages2 <- simAges(N0=500,A=0.35,rand=FALSE)
table(bg.ages2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.