m: natural mortality

mR Documentation

natural mortality

Description

Method to compute natural mortality.

Usage

## S4 method for signature 'a4aM'
m(object, grMod = "missing", ...)

Arguments

object

a a4aM object

grMod

a a4aGr object from which the growth parameter K can be extracted

...

placeholder for covariates of the models. The names must match formula variables (not parameters), with the exception of the a4aGr individual growth model. To use a growth model, it must be called grMod and be of class a4aGr, in which case the parameters will be matched. The main objective is to be able to use K from von Bertalanffy models in M.

Details

The method uses the range slot to define the quant and year dimensions of the resulting M FLQuant. The name for the quant dimension is taken as the name of a variable that is present in the shape formula, but not in the params slot of the shape model. If more than one such variable exists, then there is a problem with the shape model definition.

Value

an FLQuant object

Examples

age <- 0:15
k <- 0.4
shp <- eval(as.list(~exp(-age-0.5))[[2]], envir=list(age=age))
lvl <- eval(as.list(~1.5*k)[[2]], envir=list(k=k))
M <- shp*lvl/mean(shp)
# Now set up an equivalent a4aM object
mod1 <- FLModelSim(model=~exp(-age-0.5))
mod2 <- FLModelSim(model=~1.5*k, params=FLPar(k=0.4))
m1 <- a4aM(shape=mod1, level=mod2)
  # set up the age range for the object...
  range(m1, c("min", "max")) <- c(0,15)
  # ...and the age range for mbar
  range(m1, c("minmbar", "maxmbar")) <- c(0,15)
m(m1)
mean(m(m1)[ac(0:15)])
all.equal(M, c(m(m1)))

# another example m
range(m1, c("min", "max")) <- c(2,15)
range(m1, c("minmbar", "maxmbar")) <- c(2,4)
m(m1)
mean(m(m1)[ac(2:4)])

# example with specified iters (i.e. not simulated from a statistical distribution)...
mod2 <- FLModelSim(model=~k^0.66*t^0.57,
  params=FLPar(matrix(c(0.4,10,0.5,11), ncol=2, dimnames=list(params=c("k","t"), iter=1:2))),
  vcov=array(c(0.004,0.,0.,0.001,0.006,0.,0.,0.002), dim=c(2,2,2)))
m2 <- a4aM(shape=mod1, level=mod2)
range(m2, c("min", "max")) <- c(2,10)
m(m2)
# ...and with randomly generated iters (based on the medians for params(mod2) and vcov(mod2))
m3 <- a4aM(shape=mod1, level=mvrnorm(100, mod2))
range(m3, c("min", "max")) <- c(0,15)
m(m3)

# example with a trend
mod3 <- FLModelSim(model=~1+b*v, params=FLPar(b=0.05))
mObj <- a4aM(shape=mod1, level=mvrnorm(100, mod2), trend=mod3,
  range=c(min=0,max=15,minyear=2000,maxyear=2003,minmbar=0,maxmbar=0))
m(mObj, v=1:4)

flr/FLa4a documentation built on June 4, 2023, 11:05 a.m.