#' lorenzen
#'
#' Lorenzen natural mortality equation provides an estimate of M
#' as a function of weight. M=a*wt^b;
#'
#' @param wt mass at which M is to be predicted
#' @param par an FLPar with two values; i.e. a equal to M at unit mass
#' and b a power term; defaults are a=0.3 and b=-0.288
#'
#' #' @export
#' @docType methods
#' @rdname lorenzen
#'
#' @seealso \code{\link{chenWatanabe},\link{gislason}}
#'
#' @examples
#' \dontrun{
#' mass=FLQuant(c( 1.90, 4.23, 7.47,11.48,16.04,20.96,26.07,31.22,
#' 36.28,41.17,45.83,50.20,54.27,58.03,61.48,64.62),
#' dimnames=list(age=1:16))
#' lorenzen(mass)
#' }
lorenzenFn<-function(wt,a=.3,b=-0.288) {
if ("FLPar"%in%is(b)) res=wt%^%b else res=wt^b
if ("FLPar"%in%is(a)) res=a%*%res else res=a*res
res}
setGeneric('lorenzen', function(wt,par,...)
standardGeneric('lorenzen'))
setMethod('lorenzen', signature(wt='FLQuant',par='missing'),
function(wt,...) {
res=lorenzenFn(wt)
res@units='yr^-1'
res})
setMethod('lorenzen', signature(wt='FLQuant',par='numeric'),
function(wt,par,...) {
res=par[1]*wt^par[2]
res@units='yr^-1'
res})
setMethod('lorenzen', signature(wt='FLQuant',par='FLPar'),
function(wt,par,...){
res=par[1]%*%(wt%^%par[2])
res@units='yr^-1'
res})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.