R: Normal Bulk with GPD Upper and Lower Tails Interval...
itmgng
R Documentation
Normal Bulk with GPD Upper and Lower Tails Interval Transition Mixture Model
Description
Density, cumulative distribution function, quantile function and
random number generation for the extreme value mixture model with normal
for bulk distribution between the upper and lower thresholds with
conditional GPD's for the two tails and interval transition. The parameters are the normal mean
nmean and standard deviation nsd, interval half-width espilon,
lower tail (threshold ul, GPD scale sigmaul and shape xil and
tail fraction phiul) and upper tail (threshold ur, GPD scale
sigmaur and shape xiR and tail fraction phiuR).
The interval transition extreme value mixture model combines a normal
distribution for the bulk between the lower and upper thresholds and GPD for
upper and lower tails, with a smooth transition over the interval
(u-epsilon, u+epsilon) (where u can be exchanged for the lower and
upper thresholds). The mixing function warps the normal to map from
(u-epsilon, u) to (u-epsilon, u+epsilon) and warps the GPD from
(u, u+epsilon) to (u-epsilon, u+epsilon).
The cumulative distribution function is defined by
F(x)=κ(G_l(q(x)) + H_t(r(x)) + G_u(p(x)))
where H_t(x) is the truncated normal cdf, i.e. pnorm(x, nmean, nsd).
The conditional GPD for the upper tail has cdf G_u(x),
i.e. pgpd(x, ur, sigmaur, xir) and lower tail cdf G_l(x) is for the
negated support, i.e. 1 - pgpd(-x, -ul, sigmaul, xil). The truncated
normal is not renormalised to be proper, so H_t(x) contributes
pnorm(ur, nmean, nsd) - pnorm(ul, nmean, nsd) to the cdf
for all x≥q (u_r + ε) and zero below x≤q (u_l - ε).
The normalisation constant κ ensures a proper density, given by
1/(2 + pnorm(ur, nmean, nsd) - pnorm(ul, nmean, nsd) where the
2 is from two GPD components and latter is contribution from normal component.
The mixing functions q(x), r(x) and p(x) are reformulated from the
q_i(x) suggested by Holden and Haug (2013). These are symmetric about each
threshold, which for convenience will be referred to a simply u. So for
computational convenience only a single q(x;u) has been implemented for the
lower and upper GPD components called
qmix for a given u, with the complementary
mixing function then defined as p(x;u)=-q(-x;-u). The bulk model mixing
function r(x) utilises the equivalent of the q(x) for the lower threshold and
p(x) for the upper threshold, so these are reused in the bulk mixing function
qgbgmix.
A minor adaptation of the mixing function has been applied following a similar
approach to that explained in ditmnormgpd. For the
bulk model mixing function r(x), we need r(x)<=ul for all x≤ ul - epsilon and
r(x)>=ur for all x≥ ur+epsilon, as then the bulk model will contribute
zero below the lower interval and the constant H_t(ur)=H(ur)-H(ul) for all
x above the upper interval. Holden and Haug (2013) define
r(x)=x-ε for all x≥ ur and r(x)=x+ε for all x≤ ul.
For more straightforward and interpretable
computational implementation the mixing function has been set to the lower threshold
r(x)=u_l for all x≤ u_l-ε and to the upper threshold
r(x)=u_r for all x≤ u_r+ε, so the cdf/pdf of the normal model can be used
directly. We do not have to define cdf/pdf for the non-proper truncated normal
seperately. As such r'(x)=0 for all x≤ u_l-ε and x≥ u_r+ε in
qmixxprime, which also makes it clearer that
normal does not contribute to either tails beyond the intervals and vice-versa.
The quantile function within the transition interval is not available in
closed form, so has to be solved numerically. Outside of the
interval, the quantile are obtained from the normal and GPD components directly.
Value
ditmgng gives the density,
pitmgng gives the cumulative distribution function,
qitmgng gives the quantile function and
ritmgng gives a random sample.
Note
All inputs are vectorised except log and lower.tail.
The main input (x, p or q) and parameters must be either
a scalar or a vector. If vectors are provided they must all be of the same length,
and the function will be evaluated for each element of vector. In the case of
ritmgng any input vector must be of length n.
Default values are provided for all inputs, except for the fundamentals
x, q and p. The default sample size for
ritmgng is 1.
Missing (NA) and Not-a-Number (NaN) values in x,
p and q are passed through as is and infinite values are set to
NA. None of these are not permitted for the parameters.
Error checking of the inputs (e.g. invalid probabilities) is carried out and
will either stop or give warning message as appropriate.
Scarrott, C.J. and MacDonald, A. (2012). A review of extreme value
threshold estimation and uncertainty quantification. REVSTAT - Statistical
Journal 10(1), 33-59. Available from http://www.ine.pt/revstat/pdf/rs120102.pdf
Holden, L. and Haug, O. (2013). A mixture model for unsupervised tail
estimation. arxiv:0902.4137