Some code examples of simulating length-at-age data and fitting von Bertallanfy growth models in TMB, JAGS, and Stan that I wrote while studying spatially-varying growth of Sheepshead. Stan models used in the final publication are included, but see here for full analysis. The following models are included in the R folder:
- Maximum likelihood three parameter von Bertallanfy model fit in TMB link
- Maximum likelihood three parameter von Bertallanfy model fit in TMB where the likelihood function is a truncated normal distribution (upper and lower truncation points link
- Bayesian likelihood three parameter von Bertallanfy model fit in JAGS with normally distributed group level parameters and global hyperparameters link
- Bayesian likelihood three parameter von Bertallanfy model fit in JAGS with multivariate normal group and individual level parameters and global hyperparameters and environmental covariates link. The model is sructured similar to Helser and Lai (2004), but accounts for repeated sampling and sex/location effects.
- Bayesian likelihood three parameter von Bertallanfy model fit in Stan with normally distributed group level parameters and global hyperparameters link
TMB (Template Model Builder) is an R package for fitting statistical latent variable models to data. It is strongly inspired by ADMB. Unlike most other R packages the model is formulated in C++. This provides great flexibility, but requires some familiarity with the C/C++ programming language. See their GitHub for more information. You can also fit TMB models in Stan using the adnuts package. Alternatively, JAGS is Just Another Gibbs Sampler. Stan is a more efficient sampler and my recommended program for Bayesian analysis.
Citation: Adams, G.D., Leaf, R.T., Ballenger, J.C., Arnott, S.A., Mcdonough, C.J., 2018. Spatial variability in the growth of Sheepshead (Archosargus probatocephalus) in the Southeast US : Implications for assessment and management. Fish. Res. 206, 35–43. doi:10.1016/j.fishres.2018.04.023