Estimate_Len_Maturity {AquaticLifeHistory}  R Documentation 
Estimate lengthatmaturity
Description
Lengthatmaturity is estimated from binary maturity data using a logistic ogive. Two options are available depending on error structure. If binary data are used then a binomial error structure is required. If the user wishes to bin the data by length class then a quasi binomial error structure is needed with the data weighted by the sample size of each bin. This is handled automatically by the function.
Usage
Estimate_Len_Maturity(
data,
error.structure = "binomial",
n.bootstraps = 1000,
bin.width = NA,
display.points = FALSE,
return = "parameters"
)
Arguments
data 
A dataframe that includes length and a binary maturity status (immature = 0 and mature = 1). Columns should be named "Length" and "Maturity" but the function is robust enough to accept some reasonable variations to these 
error.structure 
The distribution for the glm used to produce the logistic ogive. Must be either "binomial" for binary data or "quasi binomial" for binned maturity at length. Proportion mature at each length bin is automatically calculated within the function 
n.bootstraps 
Number of bootstrap iterations required to produce 95% confidence intervals about the logistic ogive 
bin.width 
The width of the lengthclass bins used for a quasi binomial logistic model. These should on the same unit as the length data. The y axis on any plots will automatically scale to the correct unit ("cm" or "mm") 
display.points 
Should the raw data be plotted for the binomial model? 
return 
Either:

Value
Either:
 parameters
a dataframe of the estimated logistic parameters and their standard error (L50 and L95)
 estimates
a dataframe of logistic ogive predictions with 95 percent confidence intervals
 plot
a ggplot object of the logistic ogive. If binned length classes are used, this includes a bar plot of proportional maturity
Examples
# load example data set
data("maturity_data")
# Run function to estimate lengthatmaturity parameters
Estimate_Len_Maturity(maturity_data)
# A plot can also be returned with bootstrapped CI's. Use 100 bootstraps for
# testing and then increase to at least 1000 for actual model runs.
Estimate_Len_Maturity(maturity_data, return = "plot",n.bootstraps = 100)