simLenFromAge {FSATeach}R Documentation

Simulate fish length from given ages.

Description

Constructs simulated fish lengths from a set of given ages and parameters for a von Bertalanffy growth model supplied by the user.

Usage

  simLenFromAge(ages, Linf, K, t0, sigma, additive = TRUE,
    digits = 0)

Arguments

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- (TRUE; default) or multiplicative-error version of the von Bertalanffy growth model.

digits

A numeric controlling the number of digits to which the length data should be rounded before returning.

Details

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.

Value

A vector containing the simulated lengths for individual fish.

See Also

simAges, simLenSelectP, simLenSelectM

Examples

## Load FSA package for Summarize()
library(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")

[Package FSATeach version 0.0.1 Index]