### * TPM PREDICTOR FUNCTIONS
### * Gaussian TPM
#' Gaussian TPM
#'
#' Predicts performance (p) at a given temperature (t) using a Gaussian thermal-performance model (TPM)
#'
#' @param t A temperature value or vector.
#' @param s Scaling parameter.
#' @param a Parameter equivalent to topt or the mean of the distribution.
#' @param b Parameter equivalent to standard deviation.
#'
#' @return A value or vector of predicted performance values
#'
#' @references Lynch, M., Gabriel, W., Environmental tolerance. The American Naturalist. 129, 283–303. (1987)
#'
#' @examples
#' t <- seq(20,30, by = 0.1)
#' p <- gaussian(t = t, s = 10, a = 25, b = 2)
#' plot(t,p,type = "l", lwd = 2, xlab = "Temperature", ylab = "Predicted Performance")
#'
#' @return
gaussian <- function(t,s,a,b){
p <- s*exp(-0.5*((t-a)/b)^2)
return(p)
}
### * Weibull TPM
#' Weibull TPM
#'
#' Predicts performance (p) at a given temperature(t) using a Weibull thermal-performance model (TPM).
#'
#' @param t A temperature value or vector.
#' @param s Scaling parameter.
#' @param a Parameter equivalent to topt.
#' @param b Parameter equivalent to the breath of the curve.
#' @param c Parameter defining the shape of the curve.
#'
#' @return A value or vector of predited performance values
#'
#' @references Angilletta Jr, Michael J. Estimating and comparing thermal performance curves. Journal of Thermal Biology 31.7 (2006): 541-545.
#'
#' @examples
#' t <- seq(20,30, by = 0.1)
#' p <- weibull(t = t, s = 10, a = 25, b = 5000, c = 6000)
#' plot(t,p,type = "l", lwd = 2, xlab = "Temperature", ylab = "Predicted Performance")
#'
#' @return
weibull <- function(t,s,a,b,c){
p <- ((s*(((c-1)/c)^((1-c)/c))*((((t-a)/b)+(((c-1)/c)^(1/c)))^(c-1))*(exp(-((((t-a)/b)+(((c-1)/c)^(1/c)))^c)+((c-1)/c)))))
return(p)
}
### * Flinn TPM
#' Flinn TPM
#'
#' Predicts performance (p) at a given temperature (t) using a Flinn thermal-performance model (TPM).
#'
#' @param t A temperature value or vector
#' @param a Parameter controlling the height of the curve.
#' @param b A parameter controlling for the slope of the initial increase of the curve
#' @param c A parameter that controls the position of steepness of the decline of the curve.
#'
#' @return A value or vector of predicted performance values
#'
#' @references Flinn PW Temperature-dependent functional response of the parasitoid Cephalonomia waterstoni (Gahan) (Hymenoptera, Bethylidae) attacking rusty grain beetle larvae (Coleoptera, Cucujidae). Environmental Entomology, 20, 872–876, (1991)
#'
#' @examples
#' t <- seq(20,30, by = 0.1)
#' p <- flinn(t = t, a = 7.25, b = -0.55, c = 0.01)
#' plot(t,p,type = "l", lwd = 2, xlab = "Temperature", ylab = "Predicted Performance")
#'
#' @return
flinn <- function(t,a,b,c){
p <- 1/(1+a+b*t+c*(t^2))
return(p)
}
#' Spain TPM
#'
#' Predicts performance (p) at a given temperature (t) using a Spain thermal-performance model (TPM).
#'
#' @param t A temperature value or vector
#' @param s Scaling parameter
#' @param a Parameter determining the steepness of the rising portion of the curve.
#' @param b Parameter determining the position of the maximum of the curve (Topt).
#' @param c Parameter determining the steepness of the decreasing part of the curve.
#'
#' @return A value or vector of predicted performance values
#'
#' @references BASIC Microcomputer Models in Biology. Addison-Wesley, Reading, MA. 1982
#'
#' @examples
#' t <- seq(20,30, by = 0.1)
#' p <- spain(t = t, s = 0.6, a = 0.25, b = 0.95, c = 0.002)
#' plot(t,p,type = "l", lwd = 2, xlab = "Temperature", ylab = "Predicted Performance")
#'
#' @return
spain <- function(t,s,a,b,c){
p <- s*exp(a*t)*(1-b*exp(c*t))
return(p)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.