% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gamma.R
\name{gamma_gpd}
\alias{gamma_gpd}
\alias{dGammaGpd}
\alias{pGammaGpd}
\alias{rGammaGpd}
\alias{qGammaGpd}
\title{Gamma with a GPD tail}
\usage{
dGammaGpd(x, shape, scale, threshold, tail_scale, tail_shape, log = 0)

pGammaGpd(
  q,
  shape,
  scale,
  threshold,
  tail_scale,
  tail_shape,
  lower.tail = 1,
  log.p = 0
)

rGammaGpd(n, shape, scale, threshold, tail_scale, tail_shape)

qGammaGpd(
  p,
  shape,
  scale,
  threshold,
  tail_scale,
  tail_shape,
  lower.tail = TRUE,
  log.p = FALSE,
  tol = 1e-10,
  maxiter = 200
)
}
\arguments{
\item{x}{Numeric scalar giving the point at which the density is evaluated.}

\item{shape}{Numeric scalar Gamma shape parameter.}

\item{scale}{Numeric scalar scale parameter for the Gamma bulk.}

\item{threshold}{Numeric scalar threshold at which the GPD tail is attached.}

\item{tail_scale}{Numeric scalar GPD scale parameter; must be positive.}

\item{tail_shape}{Numeric scalar GPD shape parameter.}

\item{log}{Integer flag \code{0/1}; if \code{1}, return the log-density.}

\item{q}{Numeric scalar giving the point at which the distribution function is evaluated.}

\item{lower.tail}{Integer flag \code{0/1}; if \code{1} (default), probabilities are
\eqn{P(X \le q)}.}

\item{log.p}{Integer flag \code{0/1}; if \code{1}, probabilities are returned on the log scale.}

\item{n}{Integer giving the number of draws. The RNG implementation supports \code{n = 1}.}

\item{p}{Numeric scalar probability in \eqn{(0,1)} for the quantile function.}

\item{tol}{Numeric tolerance for numerical inversion in \code{qGammaGpd}.}

\item{maxiter}{Maximum iterations for numerical inversion in \code{qGammaGpd}.}
}
\value{
Spliced density/CDF/RNG functions return numeric scalars.
\code{qGammaGpd()} returns a numeric vector with the same length as \code{p}.
}
\description{
Spliced family obtained by attaching a generalized Pareto tail above \code{threshold} to a single
gamma bulk distribution.
}
\details{
This topic combines a single gamma bulk with a generalized Pareto exceedance model. If
\eqn{F_\Gamma(u)} is the bulk probability below the threshold, then the splice replaces the
upper tail by \eqn{\{1-F_\Gamma(u)\}g_{GPD}(x)} while leaving the lower region unchanged. The
resulting distribution is continuous at the threshold and preserves the gamma body exactly below
\eqn{u}.

The ordinary mean is finite only when the GPD shape satisfies \eqn{\xi < 1}. For heavier tails,
predictive mean summaries should be replaced by restricted means or quantile summaries.
}
\section{Functions}{
\itemize{
\item \code{dGammaGpd()}: Gamma + GPD tail density

\item \code{pGammaGpd()}: Gamma + GPD tail distribution function

\item \code{rGammaGpd()}: Gamma + GPD tail random generation

\item \code{qGammaGpd()}: Gamma + GPD tail quantile function

}}
\examples{
scale <- 2.5
shape <- 4
threshold <- 3
tail_scale <- 0.9
tail_shape <- 0.2

dGammaGpd(4.0, scale = scale, shape = shape,
         threshold = threshold, tail_scale = tail_scale,
         tail_shape = tail_shape, log = 0)
pGammaGpd(4.0, scale = scale, shape = shape,
         threshold = threshold, tail_scale = tail_scale,
         tail_shape = tail_shape, lower.tail = 1, log.p = 0)
qGammaGpd(0.50, scale = scale, shape = shape,
         threshold = threshold, tail_scale = tail_scale,
         tail_shape = tail_shape)
qGammaGpd(0.95, scale = scale, shape = shape,
         threshold = threshold, tail_scale = tail_scale,
         tail_shape = tail_shape)
replicate(10, rGammaGpd(1, scale = scale, shape = shape,
                       threshold = threshold,
                       tail_scale = tail_scale,
                       tail_shape = tail_shape))

}
\seealso{
\code{\link[=gamma_mix]{gamma_mix()}}, \code{\link[=gamma_mixgpd]{gamma_mixgpd()}}, \code{\link[=gpd]{gpd()}}, \code{\link[=gamma_lowercase]{gamma_lowercase()}}.

Other gamma kernel families: 
\code{\link{gamma_mix}},
\code{\link{gamma_mixgpd}}
}
\concept{gamma kernel families}
