Learn R Programming

trps

Bayesian trophic position models using stan (pronounced trips) 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.

Trophic Models in {trps}

Currently {trps} supports the following models:

  1. One Source Model - one_source_model()

  2. Two Source Model - two_source_model()

  3. Two Source Model - $\alpha$ corrected ($\alpha_r$) - two_source_model_ar()

  4. Two Source Model - $\alpha$ corrected ($\alpha_r$) - carbon mixing model - two_source_model_arc()

Installation

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.

Vignettes

Introduction

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.

Supplementary Vignettes

  1. 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.

  2. 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.

  3. 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$).

Citations

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/

Copy Link

Version

Install

install.packages('trps')

Version

0.1.0

License

CC0

Issues

Pull Requests

Stars

Forks

Maintainer

Benjamin Hlina

Last Published

March 21st, 2025

Functions in trps (0.1.0)

two_source_priors

Bayesian priors - Two Source Trophic Position
two_source_model_ar

Bayesian model - Two Source Trophic Position with \(\alpha_r\)
two_source_priors_params

Adjust Bayesian priors - Two Source Trophic Position
two_source_model_arc

Bayesian model - Two Source Trophic Position with \(\alpha_r\) and carbon mixing model
two_source_priors_params_arc

Adjust Bayesian priors - Two Source Trophic Position with \(\alpha_r\) and carbon mixing model
two_source_model

Bayesian model - Two Source Trophic Position
one_source_priors

Bayesian priors - One Source Trophic Position
one_source_model

Bayesian model - One Source Trophic Position
add_alpha

Calculate and add \(\alpha\)
trps-package

trps: Bayesian Trophic Position Models using 'stan'
baseline_1_iso

Stable isotope data for amphipods (baseline 1)
consumer_iso

Stable isotope data for lake trout (consumer)
one_source_priors_params

Adjust Bayesian priors - One Source Trophic Position
baseline_2_iso

Stable isotope data for dreissenids (baseline 2)
combined_iso

Stable isotope data for lake trout, amphipods (benthic baseline; baseline 1) and dreissenids (pelagic baseline; baseline 2),
two_source_priors_ar

Bayesian priors - Two Source Trophic Position with \(\alpha_r\)
two_source_priors_arc

Bayesian priors - Two Source Trophic Position with \(\alpha_r\) and carbon mixing model
two_source_priors_params_ar

Adjust Bayesian priors - Two Source Trophic Position with \(\alpha_r\)