Skip to contents

Spliced bulk-tail family formed by attaching a generalized Pareto tail to an Amoroso mixture bulk. Let \(F_{mix}\) denote the Amoroso mixture CDF. The spliced CDF is \(F(x)=F_{mix}(x)\) for \(x<threshold\) and \(F(x)=F_{mix}(threshold) + \left\{1-F_{mix}(threshold)\right\}G(x)\) for \(x\ge threshold\), where \(G\) is the GPD CDF for exceedances above threshold.

Usage

dAmorosoMixGpd(
  x,
  w,
  loc,
  scale,
  shape1,
  shape2,
  threshold,
  tail_scale,
  tail_shape,
  log = 0
)

pAmorosoMixGpd(
  q,
  w,
  loc,
  scale,
  shape1,
  shape2,
  threshold,
  tail_scale,
  tail_shape,
  lower.tail = 1,
  log.p = 0
)

rAmorosoMixGpd(
  n,
  w,
  loc,
  scale,
  shape1,
  shape2,
  threshold,
  tail_scale,
  tail_shape
)

qAmorosoMixGpd(
  p,
  w,
  loc,
  scale,
  shape1,
  shape2,
  threshold,
  tail_scale,
  tail_shape,
  lower.tail = TRUE,
  log.p = FALSE,
  tol = 1e-10,
  maxiter = 200
)

Arguments

x

Numeric scalar giving the point at which the density is evaluated.

w

Numeric vector of mixture weights of length \(K\). The functions treat the weights as non-negative and normalize them internally when needed.

loc

Numeric vector of length \(K\) giving component locations.

scale

Numeric vector of length \(K\) giving component scales.

shape1

Numeric vector of length \(K\) giving the first Amoroso shape parameter for each component.

shape2

Numeric vector of length \(K\) giving the second Amoroso shape parameter for each component.

threshold

Numeric scalar threshold at which the GPD tail is attached.

tail_scale

Numeric scalar GPD scale parameter; must be positive.

tail_shape

Numeric scalar GPD shape parameter.

log

Logical; if TRUE, return the log-density (integer flag 0/1 in NIMBLE).

q

Numeric scalar giving the point at which the distribution function is evaluated.

lower.tail

Logical; if TRUE (default), probabilities are \(P(X \le q)\).

log.p

Logical; if TRUE, probabilities are returned on the log scale.

n

Integer giving the number of draws. For portability inside NIMBLE, the RNG implementation supports n = 1.

p

Numeric scalar probability in \((0,1)\) for the quantile function.

tol

Numeric scalar tolerance passed to stats::uniroot in quantile inversion.

maxiter

Integer maximum number of iterations for stats::uniroot.

Value

Spliced density/CDF/RNG functions return numeric scalars. qAmorosoMixGpd() returns a numeric vector with the same length as p.

Details

The density, CDF, and RNG are implemented as nimbleFunctions for use in NIMBLE models. The quantile function is an R function that uses numerical inversion in the bulk region and the closed-form GPD quantile in the tail region.

The Amoroso mixture describes the bulk up to the threshold and the generalized Pareto describes exceedances above it. If \(F_{mix}(u)=p_u\), then the splice uses $$ f(x) = \left\{ \begin{array}{ll} f_{mix}(x), & x < u, \\ (1-p_u) g_{GPD}(x \mid u,\sigma_u,\xi), & x \ge u. \end{array} \right. $$ Bulk quantiles are computed numerically from the Amoroso mixture CDF and tail quantiles are obtained from the GPD inverse after rescaling the tail probability.

Functions

  • dAmorosoMixGpd(): Density Function of Amoroso Mixture Distribution with GPD Tail

  • pAmorosoMixGpd(): Cumulative Distribution Function of Amoroso Mixture Distribution with GPD Tail

  • rAmorosoMixGpd(): Random Generation for Amoroso Mixture Distribution with GPD Tail

  • qAmorosoMixGpd(): Quantile Function of Amoroso Mixture Distribution with GPD Tail

See also

Examples

w <- c(0.60, 0.25, 0.15)
loc <- c(0, 1, 2)
scale <- c(1.0, 1.2, 1.6)
shape1 <- c(2, 4, 6)
shape2 <- c(1.0, 1.2, 1.5)
threshold <- 3
tail_scale <- 1.0
tail_shape <- 0.2

dAmorosoMixGpd(4.0, w, loc, scale, shape1, shape2,
              threshold, tail_scale, tail_shape, log = 0)
#> [1] 0.1642462
pAmorosoMixGpd(4.0, w, loc, scale, shape1, shape2,
              threshold, tail_scale, tail_shape, lower.tail = 1, log.p = 0)
#> [1] 0.8029046
qAmorosoMixGpd(0.50, w, loc, scale, shape1, shape2,
              threshold, tail_scale, tail_shape)
#> [1] 2.929829
qAmorosoMixGpd(0.95, w, loc, scale, shape1, shape2,
              threshold, tail_scale, tail_shape)
#> [1] 5.893917
replicate(10, rAmorosoMixGpd(1, w, loc, scale, shape1, shape2,
                            threshold, tail_scale, tail_shape))
#>  [1] 0.2579286 0.2150753 3.4350296 2.0246966 1.6155426 3.5391621 2.6283016
#>  [8] 3.1640176 5.2699864 3.2839365