Bayesian trophic position models using stan (pronounced tropes) by leveraging {brms}. Equations for trophic position models are derived from Post (2002), Vander Zanden and Vadeboncoeur (2002), and Heuvel et al. (2024) and are to be used with stable isotope data.
Currently {trps} supports the following models:
-
One Source Model -
one_source_model()
-
Two Source Model -
two_source_model()
-
Two Source Model -
$\alpha$ corrected ($\alpha_r$ ) -two_source_model_ar()
-
Two Source Model -
$\alpha$ corrected ($\alpha_r$ ) - carbon mixing model -two_source_model_arc()
You can install the CRAN version of {trps} using the following:
install.packages("trps")
You can install the R-Universe version of {trps} using the following:
install.packages("trps",
repos = c("https://benjaminhlina.r-universe.dev",
"https://cloud.r-project.org"))
You can install the development version of {trps} using the following:
devtools::install_github("benjaminhlina/trps")
To view the overall progress of the package please see news.
I highly suggest going through the vignettes as they will walk you through how to use each trophic position model using {trps} and {brms}. The first vignette to walk through is getting started with trps. This vignette will introduce you to {trps} and how to estimate trophic position using a one source model. You can access the vignette by visiting the get started page on the website or by using the following code.
vignette("trps")
Please go through getting started with trps prior to walking through the other vignettes.
-
The next vignette will walk you through how to apply {trps} with iterative processes. This vignette is titled Estimate Trophic Position - One Source Model - Multiple Groups.
-
The third vignette to walk through is Estimating Trophic Postion - Two Source Model. which will demonstrate how to estimate trophic position using a two source model.
-
The last vignette to walk through is Estimating Trophic Postion - Two Source Model - ar. This vignette will guide you through estimating trophic position using a two source model using an equation based on Heuvel et al. (2024) that corrects (i.e., scales)
$\alpha$ ($\alpha_r$ ).
To cite this package please cite the following publications
-
Post, D.M. 2002. Using Stable Isotopes to Estimate Trophic Position: Models, Methods, and Assumptions. Ecology 83(3): 703-718. doi: 10.2307/3071875.
-
Vander Zanden, M.J., and Vadeboncoeur, Y. 2002. Fishes as integrators of benthic and pelagic food webs in lakes. Ecology 83(8): 2152–2161. link here.
-
Heuvel, C., Zhao, Y., and Fisk, A.T. 2025. Food web structure across basins in Lake Erie, a large freshwater ecosystem. Canadian Journal of Fisheries and Aquatic Sciences 82:1-16. doi: 10.1139/cjfas-2024-0028.
-
Hlina B.L. 2025. trps: Bayesian Trophic Position Models using ‘Stan’. R package version 0.1.0 (‘one-skate’). https://benjaminhlina.github.io/trps/