% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/invgauss.R
\name{InvGauss_mixgpd}
\alias{InvGauss_mixgpd}
\alias{dInvGaussMixGpd}
\alias{pInvGaussMixGpd}
\alias{rInvGaussMixGpd}
\alias{qInvGaussMixGpd}
\title{Inverse Gaussian mixture with a GPD tail}
\usage{
dInvGaussMixGpd(x, w, mean, shape, threshold, tail_scale, tail_shape, log = 0)

pInvGaussMixGpd(
  q,
  w,
  mean,
  shape,
  threshold,
  tail_scale,
  tail_shape,
  lower.tail = 1,
  log.p = 0
)

rInvGaussMixGpd(n, w, mean, shape, threshold, tail_scale, tail_shape)

qInvGaussMixGpd(
  p,
  w,
  mean,
  shape,
  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{w}{Numeric vector of mixture weights of length \eqn{K}.}

\item{mean, shape}{Numeric vectors of length \eqn{K} giving component means and shapes.}

\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. For portability inside NIMBLE,
the RNG implementation supports \code{n = 1}.}

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

\item{tol}{Numeric scalar tolerance passed to \code{stats::uniroot} in quantile inversion.}

\item{maxiter}{Integer maximum number of iterations for \code{stats::uniroot}.}
}
\value{
Spliced density/CDF/RNG functions return numeric scalars.
\code{qInvGaussMixGpd()} returns a numeric vector with the same length as \code{p}.
}
\description{
Spliced bulk-tail family formed by attaching a generalized Pareto tail to an inverse Gaussian
mixture bulk.
}
\details{
This family keeps the inverse-Gaussian mixture body below the threshold \eqn{u} and attaches a
generalized Pareto exceedance law to the residual survival probability above \eqn{u}. If
\eqn{F_{mix}(u)=p_u}, then the tail density is \eqn{(1-p_u)g_{GPD}(x \mid u,\sigma_u,\xi)}.

Quantile evaluation is piecewise. For probabilities at or below \eqn{p_u}, the function solves
the mixture inverse numerically; above \eqn{p_u}, it rescales the upper-tail probability and
applies the GPD inverse directly.
}
\section{Functions}{
\itemize{
\item \code{dInvGaussMixGpd()}: Inverse Gaussian mixture + GPD tail density

\item \code{pInvGaussMixGpd()}: Inverse Gaussian mixture + GPD tail distribution function

\item \code{rInvGaussMixGpd()}: Inverse Gaussian mixture + GPD tail random generation

\item \code{qInvGaussMixGpd()}: Inverse Gaussian mixture + GPD tail quantile function

}}
\examples{
w <- c(0.55, 0.30, 0.15)
mean <- c(1.0, 2.5, 5.0)
shape <- c(2, 4, 8)
threshold <- 3
tail_scale <- 0.9
tail_shape <- 0.2

dInvGaussMixGpd(4.0, w = w, mean = mean, shape = shape,
               threshold = threshold, tail_scale = tail_scale,
               tail_shape = tail_shape, log = 0)
pInvGaussMixGpd(4.0, w = w, mean = mean, shape = shape,
               threshold = threshold, tail_scale = tail_scale,
               tail_shape = tail_shape, lower.tail = 1, log.p = 0)
qInvGaussMixGpd(0.50, w = w, mean = mean, shape = shape,
               threshold = threshold, tail_scale = tail_scale,
               tail_shape = tail_shape)
qInvGaussMixGpd(0.95, w = w, mean = mean, shape = shape,
               threshold = threshold, tail_scale = tail_scale,
               tail_shape = tail_shape)
replicate(10, rInvGaussMixGpd(1, w = w, mean = mean, shape = shape,
                             threshold = threshold,
                             tail_scale = tail_scale,
                             tail_shape = tail_shape))
}
\seealso{
\code{\link[=InvGauss_mix]{InvGauss_mix()}}, \code{\link[=InvGauss_gpd]{InvGauss_gpd()}}, \code{\link[=gpd]{gpd()}}, \code{\link[=invgauss_lowercase]{invgauss_lowercase()}}, \code{\link[=dpmgpd]{dpmgpd()}}.

Other inverse-gaussian kernel families: 
\code{\link{InvGauss_gpd}},
\code{\link{InvGauss_mix}}
}
\concept{inverse-gaussian kernel families}
