Package 'fishprior'

Title: Get Priors for Life-History Traits of Fishes
Description: This package extracts information the the rfishbase R package to inform priors for parameters that are commonly included in assessment models of marine resources. The parameters of interest are life-history parameters such as natural mortality but can also pertain to parameters that are fishery-related but have implausible values due to life-history traits such as selectivity parameters.
Authors: Kelli F. Johnson [aut, cre] (ORCID: <https://orcid.org/0000-0002-5149-451X>), Jennifer S. Bigman, [aut] (ORCID: <https://orcid.org/0000-0001-8070-3061>), Eric J. Ward [aut] (ORCID: <https://orcid.org/0000-0002-4359-0296>), Carl Boettiger [aut] (ORCID: <https://orcid.org/0000-0002-1642-628X>)
Maintainer: Kelli F. Johnson <[email protected]>
License: GPL (>= 3) | file LICENSE
Version: 0.1.1.0
Built: 2026-10-07 08:27:14 UTC
Source: https://github.com/NOAA-FIMS/fishprior

Help Index


Check if the Installed Version of rfishbase is Up to Date

Description

This function compares the installed version of the rfishbase package with the latest version available on CRAN. It prints a message if the installed version is outdated.

Usage

check_rfishbase_version()

Examples

check_rfishbase_version()

Get information out of the prior class

Description

Get information out of the prior class

Usage

get_distribution(object)

## S4 method for signature 'prior'
get_distribution(object)

get_parameters(object)

## S4 method for signature 'prior'
get_parameters(object)

get_trait(object)

## S4 method for signature 'prior'
get_trait(object)

get_group(object)

## S4 method for signature 'prior'
get_group(object)

get_type(object)

## S4 method for signature 'prior'
get_type(object)

get_data(object)

## S4 method for signature 'prior'
get_data(object)

Arguments

object

An object of class prior.


Retrieve FishBase life-history trait data for species

Description

Queries FishBase via the rfishbase package and returns raw data tables containing life-history traits relevant for meta-analysis or prior construction.

Usage

get_fishbase_traits(spec_names = NULL)

Arguments

spec_names

A character vector of species names (e.g., "Gadus morhua").

Value

A tibble with metadata and trait information.


Make a prior for the growth coefficient

Description

TODO: Provide more details on the parameter.

Usage

make_growth_coefficient_prior(data, type = c("informative", "diffuse"))

Arguments

data

A data frame for a single species because you might need more than one trait to create a prior.

type

A character string indicating the type of prior. The default is "informative".


Make an information prior for natural mortality

Description

The Hamel–Cope prior for natural mortality is thought to be a good, informative prior for natural mortality. It is based on the maximum age of a fish species.

Usage

make_informative_mortality_prior(log_maximum_age)

Arguments

log_maximum_age

A numeric value representing the maximum age of the fish species on the log scale. This value must be greater than 0.

Details

The Hamel–Cope prior is based on the assumption that natural mortality follows a lognormal distribution. The mean of the lognormal distribution is calculated as 5.40 divided by the maximum age of the fish species. The standard deviation of the lognormal distribution is set to 0.31.

Value

An informative lognormal distribution is returned using the prior class.


Make a prior for natural mortality

Description

Make a prior for natural mortality using either an informative or diffuse prior. The informative prior is based on the Hamel–Cope prior, which is based on the maximum age of a fish species. The diffuse prior is based on the estimated natural mortality of a fish species.

Usage

make_mortality_prior(data, type = c("diffuse", "informative"))

Arguments

data

A data frame returned by summarize_fishbase_traits() containing life-history information for at least one fish species.

type

A character string indicating the type of prior to be created. Either "diffuse" or "informative". The default is "diffuse".

Value

A tibble is returned that contains three columns, "name" from the input data frame with the species name, "parameter" specifying which parameter the prior is for, and "prior" that contains the S4 class prior.


Summarize FishBase trait data into log-transformed traits

Description

Summarize FishBase trait data into log-transformed traits

Usage

summarize_fishbase_traits(fb)

Arguments

fb

A tibble returned by get_fishbase_traits().

Value

A tibble grouped by Species and trait with log-transformed stats.


Example trait information for three species

Description

An example of trait information obtained from FishBase for three species, European Hake, Alaska pollock, and sablefish.

Usage

traits_example

Format

who

A data frame with 19 rows and 6 columns:

Species

The latin/scientific name of the species

trait

A string in an R-code style indicating which trait the values are for

mean_normal, sd_normal

The mean and standard deviation of the given trait on the normal scale

mean, se

The mean and standard error of the given trait

Source

https://docs.ropensci.org/rfishbase/


Change FishBase trait name to snake-case descriptions

Description

The resultant trait names are the snake-case names that are used in FishLife and are preceded by ⁠log(⁠ to indicate that the traits are in log space.

Usage

translate_trait_names(trait)

Arguments

trait

A character vector of trait names from FishBase.

Value

A character vector of trait names in snake_case format rather than the format found in FishBase, which is often shorted versions of the trait names.

Examples

translate_trait_names("Loo")
translate_trait_names("K")
translate_trait_names(c("Loo", "K", "M"))