Fit and plot maturity ogives
fit_mat_ogive(dat, type = c("age", "length"), sample_id_re = FALSE, months = seq(1, 12), ageing_method_codes = NULL, usability_codes = c(0, 1, 2, 6)) plot_mat_ogive(object, xlab = if (object$type[[1]] == "age") "Age (years)" else "Length (cm)", title = if (object$type[[1]] == "age") "Age at maturity" else "Length at maturity", rug = TRUE, rug_n = 1500, x_max = 1.75, prediction_type = c("all", "male", "female", "none"))
dat | Data from |
---|---|
type | Should this be an age or length fit? |
sample_id_re | If |
months | A numeric vector indicating which months to include when fitting the maturity ogive. Defaults to all months. |
ageing_method_codes | A numeric vector of ageing method codes to filter
on. Defaults to |
usability_codes | An optional vector of usability codes.
All usability codes not in this vector will be omitted.
Set to |
object | Output from |
xlab | X axis label. |
title | Title for the plot. |
rug | Logical indicating whether rug lines should be added. |
rug_n | The number of rug lines to sample from the total number of fish. |
x_max | Used in determining the right axis limit. |
prediction_type | The prediction lines to show. Useful if you only want to show model fits when you have sufficient data. |
# d <- get_survey_samples("pacific ocean perch", ssid = 1) d <- pop_samples m <- fit_mat_ogive(d, type = "age", sample_id_re = FALSE)#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurredplot_mat_ogive(m)m <- fit_mat_ogive(d, type = "length", sample_id_re = FALSE) plot_mat_ogive(m)# NOT RUN { ## with random intercepts for sample ID: m <- fit_mat_ogive(d, type = "length", sample_id_re = TRUE) plot_mat_ogive(m) # }