Learn R Programming

rTPC

rTPC is an R package that helps fit thermal performance curves (TPCs) in R. rTPC contains 24 model formulations previously used to fit TPCs and has helper functions to help set sensible start parameters, upper and lower parameter limits and estimate parameters useful in downstream analyses, such as cardinal temperatures, maximum rate and optimum temperature.

The idea behind rTPC is to make fitting thermal performance curves easier, to provide workflows and examples of fitting TPCs without saying which model works best. Which model and which workflow is “best” is going to be down to the question that is being asked. Throughout the vignettes, Things to consider sections give some key considerations about what to consider before and during the analysis.

When developing rTPC, we made a conscious decision not to repeat code and methods that are already optimised and available in the R ecosystem. Consequently, the workflows take advantage of nls.multstart for fitting non-linear least squares regression and packages from the tidyverse for data manipulation, fitting multiple models, and visualisation. The R package car is used extensively for the bootstrapping approaches.

rTPC and the pipelines outlined in the vignettes are published in Methods in Ecology and Evolution and are open access. If this R package helps you, please cite us using the following citation:

Daniel Padfield, Hannah O’Sullivan, & Samraat Pawar (2021). rTPC and nls.multstart: A new pipeline to fit thermal performance curves in R. Methods in Ecology and Evolution. https://doi.org/10.1111/2041-210X.13585

Bugs and suggestions

Please report any bugs and suggestions to the Issues or email d.padfield@exeter.ac.uk. This could be requests for the inclusion of a new mathematical model formulation.

Installation

rTPC can easily be downloaded from GitHub using the remotes::install_github(). The vignettes are all available online, but if you would like to build them locally, add build_vignettes = TRUE into your install_github() command. However, we do not recommend doing this due to the number of extra R packages utilised in the vignettes.

# install package from GitHub
remotes::install_github("padpadpadpad/rTPC")

General pipeline

rTPC makes it easy to fit multiple models to multiple thermal performance curves.

Figure 1. General pipeline for fitting thermal performance curves using rTPC. (1) Collect, check, and manipulate data into long format. (2) Choose which models from rTPC are going to be used. Here, a random assortment of four models were chosen. (3) Fit the models to data using nls.multstart and helper functions from rTPC. (4) Models can be visualised and (5) common traits of TPCs can be estimated using rTPC::calc_params(). (6) This simple pipeline can easily be scaled up to be used on multiple curves.

Extensions to the pipeline

rTPC can also be easily used to do a number of common tasks needed when fitting TPCs, such as model selection, model averaging, incorporating model weights and bootstrapping of model fits.

Figure 2. Potential applications for fitting thermal performance curves using rTPC. (1) AIC, BIC or other metrics of model fit can be calculated to help to allow model selection or model averaging. (2) If TPCs are being fit to averages of multiple replicates, then weighted NLLS can be used that reduce parameter bias. (3) After the model has been fitted, non-parametric bootstrapping approaches can help estimate model uncertainty and calculate confidence intervals of parameters.

Getting started

  • For an introduction to rTPC, see vignette("rTPC")
  • To follow the general pipeline, see vignette("fit_many_models") and vignette("fit_many_curves").
  • For examples of extensions to this pipeline, see the vignette("model_averaging_selection"), vignette("model_weighting"), vignette("bootstrapping_models"), vignette("weighted_bootstrapping"), and vignette("bootstrapping_many_curves").

Copy Link

Version

Install

install.packages('rTPC')

Monthly Downloads

254

Version

1.0.4

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Padfield

Last Published

August 17th, 2023

Functions in rTPC (1.0.4)

get_lower_lims

Set broad lower limits on parameter values
calc_params

Calculate extra parameters of a thermal performance curve
get_skewness

Estimates skewness of a thermal performance curve
get_rmax

Estimate maximum rate of a thermal performance curve
get_e

Estimate the activation energy of a thermal performance curve
chlorella_tpc

Example metabolic thermal performance curves
get_upper_lims

Set broad upper limits on parameter values
bacteria_tpc

Example thermal performance curves of bacterial growth
get_breadth

Estimate thermal performance breadth of a thermal performance curve
beta_2012

Beta model for fitting thermal performance curves
joehnk_2008

Jöhnk model for fitting thermal performance curves
get_model_names

Lists the models available in rTPC
get_ctmax

Estimate the critical thermal maximum of a thermal performance curve
get_q10

Estimate the q10 value of a thermal performance curve
oneill_1972

O'Neill model for fitting thermal performance curves
get_thermaltolerance

Estimate thermal tolerance of a thermal performance curve
get_topt

Estimate optimum temperature of a thermal performance curve
get_start_vals

Estimate start values for TPC fitting
johnsonlewin_1946

Johnson-Lewin model for fitting thermal performance curves
hinshelwood_1947

Hinshelwood model for fitting thermal performance curves
lrf_1991

Lobry-Rosso-Flandros (LRF) model for fitting thermal performance curves
get_thermalsafetymargin

Estimate thermal safety margin of a thermal performance curve
pawar_2018

Pawar model for fitting thermal performance curves
sharpeschoolfull_1981

Full Sharpe-Schoolfield model for fitting thermal performance curves
modifiedgaussian_2006

Modified gaussian model for fitting thermal performance curves
rezende_2019

Rezende model for fitting thermal performance curves
spain_1982

Spain model for fitting thermal performance curves
kamykowski_1985

Kamykowski model for fitting thermal performance curves
thomas_2017

Thomas model (2017) for fitting thermal performance curves
weibull_1995

Weibull model for fitting thermal performance curves
thomas_2012

Thomas model (2012) for fitting thermal performance curves
lactin2_1995

Lactin2 model for fitting thermal performance curves
ratkowsky_1983

Ratkowsky model for fitting thermal performance curves
quadratic_2008

Quadratic model for fitting thermal performance curves
sharpeschoolhigh_1981

Sharpe-Schoolfield model (high temperature inactivation only) for fitting thermal performance curves
sharpeschoollow_1981

Sharpe-Schoolfield model (low temperature inactivation only) for fitting thermal performance curves
gaussian_1987

Gaussian model for fitting thermal performance curves
boatman_2017

Boatman model for fitting thermal performance curves
flinn_1991

Flinn model for fitting thermal performance curves
deutsch_2008

Modified deutsch model for fitting thermal performance curves
delong_2017

DeLong enzyme-assisted Arrhenius model for fitting thermal performance curves
briere2_1999

Briere2 model for fitting thermal performance curves
get_eh

Estimate the deactivation energy of a thermal performance curve
get_ctmin

Estimate the critical thermal minimum of a thermal performance curve