R/growthreg.R
growthreg.RdA function to extract von Bertalanffy growth parameters for fishes from back-calculated data
growthreg( length, age, id, lmax, linf_m = 0.8 * lmax, linf_sd = 0.2 * linf_m, l0_m, l0_sd = 0.2 * l0, plot = TRUE, ... )
| length |
|
|---|---|
| age |
|
| id |
|
| lmax | Maximum size. Based on this value, maximum growth rate kmax will be computed. |
| linf_m | Prior for parameter linf, . (in cm) |
| linf_sd | Prior sd for linf, asymptotic length (default set to 10% of linf_m). |
| l0_m | Prior for l0, size at hatching. (in cm) |
| l0_sd | Prior sd for l0 (default set to 10% of l0_m). |
| plot |
|
| ... | Additional arguments to |
Returns a list with three elements.
The first element is a data.frame with estimates for
linf, k and t0, sl and gp.
There is a hierarchical structure for linf and k, so that
there is a unique estimate for these parameters per individual
(linf_j, k_j).
linf and k are the population level estimates of linf
and k. kmax is the standardised growth parameter, depending
on lmax (kmax = exp(sl * log(lmax) + gp), see Morais and Bellwood
(2018) for details.
The second element is a data.frame with model fits for
the average regression across individuals (ypred_m, ypred_sd,
ypred_lb, ypred_ub), and the fitted regression er individual
(yrep_m, yrep_sd, yrep_lb, yrep_ub).
The third element is the entire stanfit object.
Nina M. D. Schiettekatte
if (FALSE) { library(dplyr) library(fishgrowbot) data(coral_reef_fishes_data) em <- filter(coral_reef_fishes_data, species == "Epinephelus merra", location == "Moorea") bc <- bcalc(data = em)$lengths growthreg(length = bc$l_m/10, age = bc$age, id = bc$id, lmax = 32, linf_m = 28, linf_sd = 5, l0_m = 0.15, l0_sd = 0.015, iter = 4000, chains = 1) }