Skip to content

helenfyan/rfishprod

 
 

Repository files navigation

rfishprod

Implements a framework to generate individual-level estimates of fish productivity, with a focus on reef fishes. This individual approach works by combining estimates of somatic growth through the von Bertalanffy Growth Model, and deterministic or stochastic natural mortality using instantaneous mortality rates.

Installation

You can install rfishprod from GitHub with:

devtools::install_github("renatoamorais/rfishprod")

To get devtools, simply use install.packages("devtools").

Although not a dependency, I recommend using R 3.6.3 or higher. This is mainly because xgboost, the machine behind internal prediction, demands R 3.6.3 in its most recent version.

Example

library(rfishprod)

# Check dataset repdata #
(repdata <- rfishprod:::repdata)

# Getting levels ready #
repdata <- tidytrait (repdata, db)

# Formula from Morais and Bellwood (2018) #
fmod <- formula (~ sstmean + MaxSizeTL + Diet + Position + Method)

# Predicting Kmax, the standardised VBGF parameter (Recommendation: use 100s to 1000s iterations) #
datagr <- predKmax (repdata, 
                    dataset = db,
                    fmod = fmod,
                    niter = 10,
                    return = 'pred')

datagr <- datagr$pred

# Predicting M/Z: the instantaneous mortality rate (Recommendation: see help file for) #
datagr$Md <- with (datagr,
                   predM (Lmeas = Size,
                          Lmax = MaxSizeTL,
                          Kmax = Kmax,
                          method = 'Gislason'))
                           

# Positioning your fish in their growth trajectory #
# aka. what's the size they're supposed to have on the next day? #
with (datagr, applyVBGF (Lmeas = Size,
                         Lmax = MaxSizeTL,
                         Kmax = Kmax))
                         
# Compare with their size on the previous day #
datagr$Size

# Estimating gross somatic growth (g) #
with(datagr, somaGain (a = a,
                       b = b,
                       Lmeas = Size,
                       Lmax = MaxSizeTL,
                       Kmax = Kmax))
                              
# Applying stochastic mortality #
applyMstoch (datagr$Md)


# Alternatively, estimating per capita mass loss due to mortality #
with(datagr, somaLoss (M = Md,
                       Lmeas = Size,
                       a = a,
                       b = b))

Citation

Please, if you’re using rfishprod, the relevant citation for the package can be obtained from:

citation("rfishprod")

Issues

Please report issues or bugs or shoot me an email (just hit ?rfishprod)

About

No description, website, or topics provided.

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%