#' Logistic growth
#'
#' Calculate size after a given time interval using the logistic formula
#'
#' @param A (numeric) Asymptotic body size (can be calculated in \code{calc.growth()})
#' @param k (numeric) Growth rate (can be calculated in \code{calc.growth()})
#' @param size1 (numeric vector) Initial body size (should be in the same units used to calculate A and k)
#' @param td (numeric vector) Time since \code{size1} (should be in the same units used to calculate A and k)
#' @return Vector of expected size(s) after the time interval(s) specified in \code{td}
#'
#' @details
#' It takes a vector of initial sizes, vector of amounts of time since those sizes were measured, and A and k from \code{calc.growth(model="logistic")} and returns the expected body sizes after the specified time intervals.
#'
#' \strong{Note}: If size1 > A, the resulting size estimate will be less than size1
#'
#' @examples
#' #For this example, assume size is in mm and time is in years
#' #calculate expected sizes of individuals that are 200 and 300 mm after 2 and 1.5 years, respectively
#' logistic(A = 393.0270,
#'  k = 0.2835795,
#'  size1 = c(200,300),
#'  td = c(2,1.5))
#'
#' @references
#' Schoener, T.W. and Schoener, A. (1978). Estimating and interpreting body-size
#' growth in some Anolis lizards. \emph{Copeia}, 1978, 390-405.
#'
#' @export
logistic<- function(A,k, size1,td){
  size2 <- (A*size1)/(size1+(A-size1)*exp(-k*td))
  size2}
