IncAAM

Version 1.9

IncAAM is an R package for Bayesian age-at-maturity analysis based on annual increment-width growth series, such as otolith increment measurements. It fits a hierarchical nonlinear mixed-effects model with a negative-exponential growth curve and fish-level varying parameters.

What’s new in version 1.9

See NEWS.md for the change log.

Installation

Install the source archive in R:

install.packages("IncAAM_1.9.tar.gz", repos = NULL, type = "source")

Or, from an unpacked package source directory:

# Requires the 'devtools' package
# devtools::install("path/to/IncAAM")

Dependencies

The model uses brms with the cmdstanr backend by default. Install the required R packages and set up a compatible CmdStan toolchain before fitting a model. The cmdstanr and CmdStan installation instructions are maintained at https://mc-stan.org/cmdstanr/.

install.packages(c("brms", "dplyr", "tidyr", "purrr", "tibble",
                   "ggplot2", "posterior", "minpack.lm"))
# Follow the cmdstanr installation instructions at mc-stan.org/cmdstanr/.
# Then run cmdstanr::install_cmdstan() if CmdStan is not yet installed.

Example

library(IncAAM)
data(plaice)

plaice_female <- plaice |>
  dplyr::filter(Sex == "female")

fit <- IncAAM(
  data = plaice_female,
  FishID = "FishID",
  Inc_num = "Inc_num",
  Inc_width = "Inc_width_mm",
  sex = "female",
  known_A50 = 7.6,
  min_max_incnum = NULL,  # No minimum original maximum (version 1.8 selection)
  max_incnum_fit = Inf,    # Fit all measured increments (version 1.8 default)
  n_iter = 1500,
  n_warmup = 750,
  n_keepdraws = 500,
  n_adapt_delta = 0.995,
  n_logc_sd = 0.1
)

fit$summary
fit$crossing_ogive
fit$crossing_ogive_prediction
fit$ogive_summary
fit$fish                  # Fish-level diagnostic estimates
fit$posterior             # Posterior hierarchical estimates

For a restricted fitting range, for example fitting only increments 2–9 from fish whose original maximum increment number is at least 8:

fit <- IncAAM(
  data = plaice_female,
  sex = "female",
  min_max_incnum = 8,
  max_incnum_fit = 9,
  min_increments = 1
)

The last example is illustrative; the selected subset must contain at least min_fish fish. Fish with only one usable fitted increment are strongly informed by hierarchical partial pooling.

Analysis groups: The function expects one analysis group at a time. Filter by species, sex, population, and anatomical axis before calling IncAAM(). The default sex-specific TR thresholds are now 0.16 for females and 0.25 for males; supply custom thresholds when needed. A threshold must be strictly between 0 and 1.

Interpretation of output tables

Both plot subtitles now report the hierarchical population TR median (rather than the selected TR threshold), and the ogive plot no longer uses the label Median A50. The original two plot outputs, fit$plot (TR/Jerk densities) and fit$ogive_plot (crossing ogive), can be displayed directly. With save_plots = TRUE, the original PDF names are retained: IncAAM_posterior_TR_Jerk.pdf and IncAAM_crossing_ogive.pdf.

Methodological reference

Details of the model, method, outputs and applications are provided in Campana, Smoliński, Morrongiello and Black (2027, in press). Users should consult that publication for methodological background, noting that version 1.9 implements the updated full-posterior hierarchical TR and analytical-ogive calculations described above.