plot_mat_ogive: Fit and plot maturity ogives

Description Usage Arguments Examples

View source: R/maturity.R

Description

Fit and plot maturity ogives

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
fit_mat_ogive_re(
  dat,
  type = c("age", "length"),
  sample_id_re = FALSE,
  year_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")
)

Arguments

dat

Data from [get_survey_samples()].

type

Should this be an age or length fit?

sample_id_re

If 'TRUE' then the model will include random intercepts for sample ID.

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 'NULL', which brings in all valid ageing codes. See [get_age_methods()].

usability_codes

An optional vector of usability codes. All usability codes not in this vector will be omitted. Set to 'NULL' to include all samples.

object

Output from [fit_mat_ogive()].

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# d <- get_survey_samples("pacific ocean perch", ssid = 1)
d <- pop_samples

m <- fit_mat_ogive(d, type = "age", sample_id_re = FALSE)
plot_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)

## End(Not run)

pbs-assess/gfranges documentation built on Dec. 13, 2021, 4:50 p.m.