Method to compute natural mortality.

# S4 method for 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.

Value

an FLQuant object

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.

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)
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#> 
#>     year
#> age  0         
#>   0  6.0684e+00
#>   1  2.2324e+00
#>   2  8.2126e-01
#>   3  3.0213e-01
#>   4  1.1115e-01
#>   5  4.0888e-02
#>   6  1.5042e-02
#>   7  5.5336e-03
#>   8  2.0357e-03
#>   9  7.4889e-04
#>   10 2.7550e-04
#>   11 1.0135e-04
#>   12 3.7285e-05
#>   13 1.3716e-05
#>   14 5.0460e-06
#>   15 1.8563e-06
#> 
#> units:  NA 
mean(m(m1)[ac(0:15)])
#> [1] 0.6
all.equal(M, c(m(m1)))
#> [1] TRUE

# another example m
range(m1, c("min", "max")) <- c(2,15)
range(m1, c("minmbar", "maxmbar")) <- c(2,4)
m(m1)
#> An object of class "FLQuant"
#> , , unit = unique, season = all, area = unique
#> 
#>     year
#> age  0         
#>   2  1.1974e+00
#>   3  4.4051e-01
#>   4  1.6206e-01
#>   5  5.9617e-02
#>   6  2.1932e-02
#>   7  8.0682e-03
#>   8  2.9681e-03
#>   9  1.0919e-03
#>   10 4.0169e-04
#>   11 1.4778e-04
#>   12 5.4363e-05
#>   13 1.9999e-05
#>   14 7.3573e-06
#>   15 2.7066e-06
#> 
#> units:  NA 
mean(m(m1)[ac(2:4)])
#> [1] 0.6

# 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)
#> An object of class "FLQuant"
#> iters:  2 
#> 
#> , , unit = unique, season = all, area = unique
#> 
#>     year
#> age  0                  
#>   2  2.2560020(0.336016)
#>   3  0.8299367(0.123613)
#>   4  0.3053167(0.045475)
#>   5  0.1123197(0.016729)
#>   6  0.0413201(0.006154)
#>   7  0.0152008(0.002264)
#>   8  0.0055921(0.000833)
#>   9  0.0020572(0.000306)
#>   10 0.0007568(0.000113)
#> 
#> units:  NA 
# ...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)
#> An object of class "FLQuant"
#> iters:  100 
#> 
#> , , unit = unique, season = all, area = unique
#> 
#>     year
#> age  0                   
#>   0  2.2472e+00(1.97e-01)
#>   1  8.2670e-01(7.24e-02)
#>   2  3.0413e-01(2.66e-02)
#>   3  1.1188e-01(9.80e-03)
#>   4  4.1159e-02(3.60e-03)
#>   5  1.5142e-02(1.33e-03)
#>   6  5.5702e-03(4.88e-04)
#>   7  2.0492e-03(1.79e-04)
#>   8  7.5385e-04(6.60e-05)
#>   9  2.7733e-04(2.43e-05)
#>   10 1.0202e-04(8.93e-06)
#>   11 3.7532e-05(3.29e-06)
#>   12 1.3807e-05(1.21e-06)
#>   13 5.0794e-06(4.45e-07)
#>   14 1.8686e-06(1.64e-07)
#>   15 6.8742e-07(6.02e-08)
#> 
#> units:  NA 

# 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)
#> An object of class "FLQuant"
#> iters:  100 
#> 
#> , , unit = unique, season = all, area = unique
#> 
#>     year
#> age  2000                 2001                 2002                
#>   0  2.3236e+00(2.29e-01) 2.4342e+00(2.40e-01) 2.5449e+00(2.51e-01)
#>   1  8.5479e-01(8.43e-02) 8.9549e-01(8.83e-02) 9.3620e-01(9.23e-02)
#>   2  3.1446e-01(3.10e-02) 3.2943e-01(3.25e-02) 3.4441e-01(3.40e-02)
#>   3  1.1568e-01(1.14e-02) 1.2119e-01(1.20e-02) 1.2670e-01(1.25e-02)
#>   4  4.2558e-02(4.20e-03) 4.4584e-02(4.40e-03) 4.6611e-02(4.60e-03)
#>   5  1.5656e-02(1.54e-03) 1.6402e-02(1.62e-03) 1.7147e-02(1.69e-03)
#>   6  5.7595e-03(5.68e-04) 6.0338e-03(5.95e-04) 6.3081e-03(6.22e-04)
#>   7  2.1188e-03(2.09e-04) 2.2197e-03(2.19e-04) 2.3206e-03(2.29e-04)
#>   8  7.7947e-04(7.69e-05) 8.1659e-04(8.05e-05) 8.5370e-04(8.42e-05)
#>   9  2.8675e-04(2.83e-05) 3.0040e-04(2.96e-05) 3.1406e-04(3.10e-05)
#>   10 1.0549e-04(1.04e-05) 1.1051e-04(1.09e-05) 1.1554e-04(1.14e-05)
#>   11 3.8807e-05(3.83e-06) 4.0655e-05(4.01e-06) 4.2503e-05(4.19e-06)
#>   12 1.4276e-05(1.41e-06) 1.4956e-05(1.48e-06) 1.5636e-05(1.54e-06)
#>   13 5.2520e-06(5.18e-07) 5.5021e-06(5.43e-07) 5.7522e-06(5.67e-07)
#>   14 1.9321e-06(1.91e-07) 2.0241e-06(2.00e-07) 2.1161e-06(2.09e-07)
#>   15 7.1078e-07(7.01e-08) 7.4463e-07(7.34e-08) 7.7848e-07(7.68e-08)
#>     year
#> age  2003                
#>   0  2.6555e+00(2.62e-01)
#>   1  9.7690e-01(9.64e-02)
#>   2  3.5938e-01(3.54e-02)
#>   3  1.3221e-01(1.30e-02)
#>   4  4.8637e-02(4.80e-03)
#>   5  1.7893e-02(1.76e-03)
#>   6  6.5823e-03(6.49e-04)
#>   7  2.4215e-03(2.39e-04)
#>   8  8.9082e-04(8.79e-05)
#>   9  3.2771e-04(3.23e-05)
#>   10 1.2056e-04(1.19e-05)
#>   11 4.4351e-05(4.37e-06)
#>   12 1.6316e-05(1.61e-06)
#>   13 6.0023e-06(5.92e-07)
#>   14 2.2081e-06(2.18e-07)
#>   15 8.1232e-07(8.01e-08)
#> 
#> units:  NA