simAges {FSATeach}R Documentation

Simulate an age structure.


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.


  simAges(N0 = 500, A = 0.3, Z = -log(1 - A), = FALSE, max.age = NULL, indivs = TRUE,
    rand = TRUE)



A numeric representing the initial cohort size to be used in the simulations.


A numeric representing the annual mortality rate to be used in the simulations.


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 A.

A logical indicating whether age-0 should be included in the ouptut (TRUE) or not (FALSE; default).


A numeric indicating the maximum age to use in the simulations. If NULL then the maximum age will be the age at which the projected cohort size is approximately equal to 1.


A logical indicating whether the output result should be ages assigned to individual fish (TRUE; default) or an age-frequency table.


A logical indicating whether the individual ages should be chosen randomly (TRUE; default) or deterministically.


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 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).

See Also

simLenFromAge, simLenSelectP, simLenSelectM


## set seed for repeatability

## Simulated individual ages (random)
bg.ages <- simAges(N0=500,A=0.35)

## Simulated age frequency (non-random)
bg.ages.sum <- simAges(N0=500,A=0.35,indivs=FALSE)

## Simulated individual ages (non-random)
bg.ages2 <- simAges(N0=500,A=0.35,rand=FALSE)

[Package FSATeach version 0.0.1 Index]