Description Usage Arguments Details Value See Also Examples
View source: R/simLenFromAge.R
Constructs simulated fish lengths from a set of given ages and parameters for a von Bertalanffy growth model supplied by the user.
1 | simLenFromAge(ages, Linf, K, t0, sigma, additive = TRUE, digits = 0)
|
ages |
A vector containg ages of individual fish. |
Linf |
A numeric representing the asyptotic mean length (L_infinity) in the von Bertalanffy growth model. |
K |
A numeric representing the Brody growth coefficient (K) in the von Bertalanffy growth model. |
t0 |
A numeric representing the time when the mean length is zero (t_0) in the von Bertalanffy growth model. |
sigma |
A numeric representing the standard deviation (i.e., individual error) around the von Bertalanffy growth model. |
additive |
A logical indicating whether the standard deviation is for
the additive- ( |
digits |
A numeric controlling the number of digits to which the length data should be rounded before returning. |
This simulation simulates fish lengths by first predicing the mean length-at-age given a fish's age using the von Bertalanffy growth model and then randomly selecting a length from a normal distribution given this mean length-at-age and the supplied value for sigma.
A vector containing the simulated lengths for individual fish.
simAges
, simLenSelectP
,
simLenSelectM
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Load FSA package for Summarize()
require(FSA)
## set seed for repeatability
set.seed(5234734)
## Simulated individual ages (random)
# see simAges functions
bg.ages <- simAges(N0=500,A=0.35)
## Simulated lengths, given the above ages
bg.lens <- simLenFromAge(bg.ages,228,0.206,0,8)
## Some summaries
df <- data.frame(age=bg.ages,len=bg.lens)
Summarize(len~age,data=df,digits=1)
plot(len~age,data=df,pch=16,col=rgb(0,0,0,0.1),xlab="Age",ylab="Length")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.