Arguments
- object
A
MizerParamsobject or aMizerSimobject- n
A matrix of species abundances (species x size).
- n_pp
A vector of the resource abundance by size
- n_other
A list of abundances for other dynamical components of the ecosystem
- time_range
A numeric or character vector of times. Only the range of values matters, so all saved times between
min(time_range)andmax(time_range)are selected.- drop
If
TRUEthen any dimension of length 1 will be removed from the returned array.- ...
Unused
Value
If a MizerParams object is passed in, returns an ArraySpeciesBySize object
(prey species x prey size) with the predation mortality rates.
If a MizerSim object is passed in, returns a three-dimensional array
(time step x prey species x prey size) with the predation mortality at
every time step. Dimensions may be dropped if they have length 1 unless
drop = FALSE.
Your own predation mortality function
By default getPredMort() calls mizerPredMort(). However you can
replace this with your own alternative predation mortality function. If
your function is called "myPredMort" then you register it in a MizerParams
object params with
Your function will then be called instead of mizerPredMort(), with the
same arguments.
See also
Other rate functions:
getDiffusion(),
getEGrowth(),
getERepro(),
getEReproAndGrowth(),
getEncounter(),
getFMort(),
getFMortGear(),
getFeedingLevel(),
getFlux(),
getMort(),
getPredRate(),
getRDD(),
getRDI(),
getRates(),
getResourceMort()
Examples
# \donttest{
params <- NS_params
# Predation mortality in initial state
M2 <- getPredMort(params)
str(M2)
#> 'ArraySpeciesBySize' num [1:12, 1:100] 3.64 4.43 4.31 4.89 4.8 ...
#> - attr(*, "dimnames")=List of 2
#> ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> - attr(*, "value_name")= chr "Predation mortality"
#> - attr(*, "units")= chr "1/year"
#> - attr(*, "params")=Formal class 'MizerParams' [package "mizer"] with 46 slots
#> .. ..@ metadata : list()
#> .. ..@ mizer_version :Classes 'package_version', 'numeric_version' hidden list of 1
#> .. .. ..$ : int [1:4] 2 5 4 9123
#> .. ..@ extensions : chr(0)
#> .. ..@ time_created : POSIXct[1:1], format: "2021-09-03 20:29:38"
#> .. ..@ time_modified : POSIXct[1:1], format: "2026-04-12 11:31:45"
#> .. ..@ w : num [1:100] 0.001 0.00119 0.00142 0.0017 0.00203 ...
#> .. ..@ dw : num [1:100] 0.000193 0.000231 0.000275 0.000329 0.000392 ...
#> .. ..@ w_full : num [1:226] 2.12e-13 2.53e-13 3.02e-13 3.61e-13 4.30e-13 ...
#> .. ..@ dw_full : num [1:226] 4.10e-14 4.90e-14 5.84e-14 6.97e-14 8.32e-14 ...
#> .. ..@ w_min_idx : Named num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..- attr(*, "names")= chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. ..@ maturity : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ psi : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ initial_n : num [1:12, 1:100] 1.84e+13 6.86e+12 1.44e+14 1.45e+13 1.71e+11 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ intake_max : num [1:12, 1:100] 0.182 0.275 0.328 0.35 0.307 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ search_vol : num [1:12, 1:100] 1.27e-13 6.00e-14 3.44e-13 4.49e-14 1.86e-13 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ metab : num [1:12, 1:100] 0.0289 0.0437 0.0522 0.0557 0.0487 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ pred_kernel : logi [1(1d)] NA
#> .. ..@ ft_pred_kernel_e : cplx [1:12, 1:226] 11.3+0i 26.9+0i 20.8+0i ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ k : chr [1:226] "1" "2" "3" "4" ...
#> .. ..@ ft_pred_kernel_p : cplx [1:12, 1:226] 11.3+0i 26.9+0i 20.8+0i ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ k : chr [1:226] "1" "2" "3" "4" ...
#> .. ..@ mu_b : num [1:12, 1:100] 0.1871 0.1817 0.1293 0.0865 0.0874 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ ext_encounter : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ ext_diffusion : num [1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ sp: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ rr_pp : Named num [1:226] 167660 158066 149021 140494 132455 ...
#> .. .. ..- attr(*, "names")= chr [1:226] "2.12e-13" "2.53e-13" "3.02e-13" "3.61e-13" ...
#> .. ..@ cc_pp : Named num [1:226] 1.09e+38 7.46e+37 5.11e+37 3.51e+37 2.41e+37 ...
#> .. .. ..- attr(*, "names")= chr [1:226] "2.12e-13" "2.53e-13" "3.02e-13" "3.61e-13" ...
#> .. ..@ resource_dynamics : chr "resource_semichemostat"
#> .. ..@ resource_params :List of 5
#> .. .. ..$ kappa : num 1e+11
#> .. .. ..$ lambda : num 2.13
#> .. .. ..$ r_pp : num 10
#> .. .. ..$ n : num 0.667
#> .. .. ..$ w_pp_cutoff: num 9.82
#> .. ..@ other_dynamics : list()
#> .. ..@ other_params : list()
#> .. ..@ other_encounter : list()
#> .. ..@ other_mort : list()
#> .. ..@ rates_funcs :List of 14
#> .. .. ..$ Rates : chr "mizerRates"
#> .. .. ..$ Encounter : chr "mizerEncounter"
#> .. .. ..$ FeedingLevel : chr "mizerFeedingLevel"
#> .. .. ..$ EReproAndGrowth: chr "mizerEReproAndGrowth"
#> .. .. ..$ PredRate : chr "mizerPredRate"
#> .. .. ..$ PredMort : chr "mizerPredMort"
#> .. .. ..$ FMort : chr "mizerFMort"
#> .. .. ..$ Mort : chr "mizerMort"
#> .. .. ..$ ERepro : chr "mizerERepro"
#> .. .. ..$ EGrowth : chr "mizerEGrowth"
#> .. .. ..$ ResourceMort : chr "mizerResourceMort"
#> .. .. ..$ RDI : chr "mizerRDI"
#> .. .. ..$ RDD : chr "BevertonHoltRDD"
#> .. .. ..$ Diffusion : chr "mizerDiffusion"
#> .. ..@ sc : num [1:100] 0.001 0.00119 0.00142 0.0017 0.00203 ...
#> .. ..@ initial_n_pp : Named num [1:226] 1.09e+38 7.46e+37 5.11e+37 3.51e+37 2.41e+37 ...
#> .. .. ..- attr(*, "names")= chr [1:226] "2.12e-13" "2.53e-13" "3.02e-13" "3.61e-13" ...
#> .. ..@ initial_n_other : list()
#> .. ..@ species_params :'data.frame': 12 obs. of 34 variables:
#> .. .. ..$ species : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. ..$ w_max : num [1:12] 33 36 100 334 324 ...
#> .. .. ..$ w_mat : int [1:12] 13 4 23 99 21 75 78 39 105 165 ...
#> .. .. ..$ beta : int [1:12] 51076 398849 22 280540 191 22 381 283 113 558 ...
#> .. .. ..$ sigma : num [1:12] 0.8 1.9 1.5 3.2 1.9 1.5 1.9 1.8 1.6 2.1 ...
#> .. .. ..$ k_vb : num [1:12] 0.681 1 0.849 0.606 0.536 0.323 0.284 0.266 0.122 0.271 ...
#> .. .. ..$ gear : chr [1:12] "Industrial" "Industrial" "Industrial" "Pelagic" ...
#> .. .. ..$ w_min : num [1:12] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 ...
#> .. .. ..$ alpha : num [1:12] 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ...
#> .. .. ..$ pred_kernel_type : chr [1:12] "lognormal" "lognormal" "lognormal" "lognormal" ...
#> .. .. ..$ h : num [1:12] 18.2 27.5 32.8 35 30.7 ...
#> .. .. ..$ k : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..$ ks : num [1:12] 3.64 5.5 6.57 7.01 6.14 ...
#> .. .. ..$ z0 : num [1:12] 0.1871 0.1817 0.1293 0.0865 0.0874 ...
#> .. .. ..$ gamma : num [1:12] 3.20e-11 1.51e-11 8.63e-11 1.13e-11 4.67e-11 ...
#> .. .. ..$ m : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ erepro : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ R_max : num [1:12] 7.38e+11 4.10e+11 1.05e+13 1.11e+12 1.12e+10 ...
#> .. .. ..$ sel_func : chr [1:12] "knife_edge" "knife_edge" "knife_edge" "knife_edge" ...
#> .. .. ..$ knife_edge_size : int [1:12] 13 4 23 99 21 75 78 39 105 165 ...
#> .. .. ..$ catchability : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ p : num [1:12] 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 ...
#> .. .. ..$ q : num [1:12] 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 ...
#> .. .. ..$ n : num [1:12] 0.667 0.667 0.667 0.667 0.667 ...
#> .. .. ..$ f0 : num [1:12] 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ...
#> .. .. ..$ interaction_resource: num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ w_inf : num [1:12] 33 36 100 334 324 ...
#> .. .. ..$ w_mat25 : num [1:12] 11.65 3.58 20.61 88.7 18.82 ...
#> .. .. ..$ w_repro_max : num [1:12] 33 36 100 334 324 ...
#> .. .. ..$ is_background : logi [1:12] FALSE FALSE FALSE FALSE FALSE FALSE ...
#> .. .. ..$ z_ext : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..$ d : num [1:12] -0.333 -0.333 -0.333 -0.333 -0.333 ...
#> .. .. ..$ E_ext : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..$ D_ext : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#> .. ..@ given_species_params :'data.frame': 12 obs. of 27 variables:
#> .. .. ..$ species : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. ..$ w_max : num [1:12] 33 36 100 334 324 ...
#> .. .. ..$ w_mat : int [1:12] 13 4 23 99 21 75 78 39 105 165 ...
#> .. .. ..$ beta : int [1:12] 51076 398849 22 280540 191 22 381 283 113 558 ...
#> .. .. ..$ sigma : num [1:12] 0.8 1.9 1.5 3.2 1.9 1.5 1.9 1.8 1.6 2.1 ...
#> .. .. ..$ k_vb : num [1:12] 0.681 1 0.849 0.606 0.536 0.323 0.284 0.266 0.122 0.271 ...
#> .. .. ..$ gear : chr [1:12] "Industrial" "Industrial" "Industrial" "Pelagic" ...
#> .. .. ..$ w_min : num [1:12] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 ...
#> .. .. ..$ alpha : num [1:12] 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ...
#> .. .. ..$ pred_kernel_type : chr [1:12] "lognormal" "lognormal" "lognormal" "lognormal" ...
#> .. .. ..$ h : num [1:12] 18.2 27.5 32.8 35 30.7 ...
#> .. .. ..$ k : num [1:12] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..$ ks : num [1:12] 3.64 5.5 6.57 7.01 6.14 ...
#> .. .. ..$ z0 : num [1:12] 0.1871 0.1817 0.1293 0.0865 0.0874 ...
#> .. .. ..$ gamma : num [1:12] 3.20e-11 1.51e-11 8.63e-11 1.13e-11 4.67e-11 ...
#> .. .. ..$ m : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ erepro : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ R_max : num [1:12] 7.38e+11 4.10e+11 1.05e+13 1.11e+12 1.12e+10 ...
#> .. .. ..$ sel_func : chr [1:12] "knife_edge" "knife_edge" "knife_edge" "knife_edge" ...
#> .. .. ..$ knife_edge_size : int [1:12] 13 4 23 99 21 75 78 39 105 165 ...
#> .. .. ..$ catchability : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ p : num [1:12] 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7 ...
#> .. .. ..$ q : num [1:12] 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 0.8 ...
#> .. .. ..$ n : num [1:12] 0.667 0.667 0.667 0.667 0.667 ...
#> .. .. ..$ f0 : num [1:12] 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 0.6 ...
#> .. .. ..$ interaction_resource: num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. .. ..$ w_inf : num [1:12] 33 36 100 334 324 ...
#> .. ..@ interaction : num [1:12, 1:12] 0.7291 0.0341 0.0635 0.2742 0.3624 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ predator: chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ prey : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. ..@ gear_params :'data.frame': 12 obs. of 5 variables:
#> .. .. ..$ gear : chr [1:12] "Industrial" "Industrial" "Industrial" "Pelagic" ...
#> .. .. ..$ species : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. ..$ sel_func : chr [1:12] "knife_edge" "knife_edge" "knife_edge" "knife_edge" ...
#> .. .. ..$ knife_edge_size: int [1:12] 13 4 23 99 21 75 78 39 105 165 ...
#> .. .. ..$ catchability : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. ..@ selectivity : num [1:4, 1:12, 1:100] 0 0 0 0 0 0 0 0 0 0 ...
#> .. .. ..- attr(*, "dimnames")=List of 3
#> .. .. .. ..$ gear: chr [1:4] "Industrial" "Pelagic" "Beam" "Otter"
#> .. .. .. ..$ sp : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. .. .. ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
#> .. ..@ catchability : num [1:4, 1:12] 1 0 0 0 1 0 0 0 1 0 ...
#> .. .. ..- attr(*, "dimnames")=List of 2
#> .. .. .. ..$ gear: chr [1:4] "Industrial" "Pelagic" "Beam" "Otter"
#> .. .. .. ..$ sp : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. ..@ initial_effort : Named num [1:4] 0 1 0.5 0.5
#> .. .. ..- attr(*, "names")= chr [1:4] "Industrial" "Pelagic" "Beam" "Otter"
#> .. ..@ A : num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
#> .. ..@ linecolour : Named chr [1:17] "#815f00" "#6237e2" "#8da600" "#de53ff" ...
#> .. .. ..- attr(*, "names")= chr [1:17] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. ..@ linetype : Named chr [1:16] "solid" "solid" "solid" "solid" ...
#> .. .. ..- attr(*, "names")= chr [1:16] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> .. ..@ ft_mask : logi [1:12, 1:226] TRUE TRUE TRUE TRUE TRUE TRUE ...
#> .. ..@ use_predation_diffusion: logi FALSE
# With constant fishing effort for all gears for 20 time steps
sim <- project(params, t_max = 20, effort = 0.5)
# Get predation mortality at one time step
M2 <- getPredMort(params, n = N(sim)[15, , ], n_pp = NResource(sim)[15, ])
# Get predation mortality at all saved time steps
M2 <- getPredMort(sim)
str(M2)
#> num [1:21, 1:12, 1:100] 3.64 3.42 3.29 3.2 3.16 ...
#> - attr(*, "dimnames")=List of 3
#> ..$ time: chr [1:21] "0" "1" "2" "3" ...
#> ..$ sp : chr [1:12] "Sprat" "Sandeel" "N.pout" "Herring" ...
#> ..$ w : chr [1:100] "0.001" "0.00119" "0.00142" "0.0017" ...
# Get predation mortality over the years 15 - 20
M2 <- getPredMort(sim, time_range = c(15, 20))
# }
