getSRPars: Summarize stock-recruit parameters

View source: R/getSRPars.R

getSRParsR Documentation

Summarize stock-recruit parameters

Description

This function samples relevant stock-recruit parameters from a dataframe containing posterior samples from MCMC sampling. Sampling is based on percentile arguments.

Usage

getSRPars(pars, alphaOnly = TRUE, highP = 0.9, lowP = 0.1, stks = NULL)

Arguments

pars

A dataframe containing stock-recruit parameters. Should be formatted so that stock/population (stk) is in first column and each subsequent column contains one parameter; each row represents one posterior sample.

alphaOnly

A logical argument. If TRUE then percentiles are only used for alpha parameter, all others use medians. If FALSE then percentiles are calculated and returned for all parameters.

highP, lowP

Numerics that represent high and low percentiles that are being estimated.

stks

A vector that is used to identify a subset of stocks for which parameters are returned. Can be either a numeric or character, but should match the format of the first column of the input dataframe.

Value

Returns a list of length three (pLow, pMed, pHigh) containing lower percentiles, medians and higher percentiles, respectively. Note that if alphaOnly = TRUE, the same median values will be returned for non-alpha parameters in all list elements.

Examples

head(rickerParameters)
d <- getSRPars(rickerParameters, alphaOnly = FALSE)
head(d$pLow) #lower percentile estimates
head(d$pMed) #median estimates

d <- getSRPars(larkinParameters, alphaOnly = TRUE)
head(d$pLow) #lower percentile estimates for alpha only

CamFreshwater/samSim documentation built on Sept. 25, 2023, 10:22 a.m.