gonad_mature: Estimate gonadal maturity

View source: R/gonadMat-main.R

gonad_matureR Documentation

Estimate gonadal maturity

Description

Estimate size at gonad maturity.

Usage

gonad_mature(
  data,
  varNames = c("allometric", "stage"),
  inmName = "inm",
  matName = "mad",
  method = "fq",
  niter = 999,
  seed = 70388
)

Arguments

data

data.frame with allometric variables and stage of sexual maturity (gonad maturation stages).

varNames

a character string indicating the name of the allometric and the stage of sexual maturity variables to be used for analysis.

inmName

a character string indicating the name or names of the immaturity stage.

matName

a character string indicating the name or names of the maturity stage.

method

a character string indicating the method to be applied, "fq" frequentist GLM, or "bayes" Bayes GLM (MCMClogit function).

niter

number of iterations (bootstrap resampling).

seed

a single value, interpreted as an integer.

Details

Estimate the size at gonad maturity using a logistic regression with X variable and stages of sexual maturity (two categories: immature and mature).

The function requires a data.frame with the X (allometric variable) and the stage of sexual maturity (gonad maturation stage).

The argument varNames requires a character string indicating the name of one allometric and the stage of sexual maturity variable to be used for analysis (i.e. varNames = c("total_length", "stage_mat")). So the argument varNames must contain two character strings only, the first is the allometric variable and the second is the stage of sexual maturity.

The arguments inmName and matName require a character string indicating the name of the stages of sexual maturity in the data.frame. The argument could contain one character string or should be a vector (i.e. inmName = "I", matName = c("II", "III", "IV")).

The argument method requires a character string indicating which regression will be used for the test. If method = "fq" the logistic regression is based on GLM (frequentist), if method = "bayes" a sample from the posterior distribution of a logistic regression model using a random walk Metropolis algorithm is generated (see MCMClogit function).

The argument niter requires a number. For the GLM regression (method = "fq"), a non-parametric bootstrap method consists in generate B bootstrap samples, by resampling with replacement the original data. Then all statistics for each parameter can be calculated from each bootstrap sample (median and confidence intervals). For the method = "bayes", the argument niter is related to the number of Metropolis iterations for the sampler.

Value

An object of class 'gonadMat'.

model the summary statistics of the model.

A_boot the 'n iter' values of parameter A.

B_boot the 'n iter' values of parameter B.

L50 the 'n iter' values of parameter L50 (size at gonad maturity).

out a dataframe with the allometric variable "X", stage of sexual maturity, the fitted values for logistic regression and confidence intervals (95%). Also the summary statistics of the model is provided.

Examples

data(matFish)

gonad_mat = gonad_mature(matFish, varNames = c("total_length", "stage_mat"), inmName = "I", 
matName = c("II", "III", "IV"), method = "fq", niter = 50)

# 'niter' parameters:
gonad_mat$A_boot
gonad_mat$B_boot
gonad_mat$L50_boot
gonad_mat$out

ejosymart/sizeMat documentation built on Jan. 4, 2024, 9:04 p.m.