R/FTG-probability.R

Defines functions pFTG

Documented in pFTG

#' FTG Probability Function
#'
#' This function computes the probability of the full-tail gamma with the input sample data. The expression for the probability used is:
#' \deqn{G(x; \alpha, \theta, \rho) = 1 - \Gamma\left(\alpha, \rho\left(1 + \frac{x}{\sigma}\right)\right)/\Gamma(\alpha, \rho).}
#' @param x Sample data.
#' @param threshold Minimum value of the tail.
#' @param scale Scale parameter.
#' @param shape Shape parameter.
#' @return Gives the distribution function of the FTG. The length of the result is determined by the length of x.
#' @keywords FTG
#' @export
#' @references del Castillo, Joan & Daoudi, Jalila & Serra, Isabel. (2012). The full-tails gamma distribution applied to model extreme values. ASTIN Bulletin. <doi:10.1017/asb.2017.9>.
#' @examples
#' pFTG(1,1,1,1)
pFTG <- function(x, threshold, scale, shape) {
  a <- shape
  s <- scale
  r <- threshold
  cdf <- 1 - gsl::gamma_inc(a, r *(1 + x / s)) / gsl::gamma_inc(a, r)
  return(cdf)
}

Try the distTails package in your browser

Any scripts or data that you put into this service are public.

distTails documentation built on Sept. 7, 2019, 9:02 a.m.