Last chance! 50% off unlimited learning
Sale ends in
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
).
ditmgng(x, nmean = 0, nsd = 1, epsilon = nsd, ul = qnorm(0.1,
nmean, nsd), sigmaul = nsd, xil = 0, ur = qnorm(0.9, nmean, nsd),
sigmaur = nsd, xir = 0, log = FALSE)pitmgng(q, nmean = 0, nsd = 1, epsilon = nsd, ul = qnorm(0.1,
nmean, nsd), sigmaul = nsd, xil = 0, ur = qnorm(0.9, nmean, nsd),
sigmaur = nsd, xir = 0, lower.tail = TRUE)
qitmgng(p, nmean = 0, nsd = 1, epsilon, ul = qnorm(0.1, nmean, nsd),
sigmaul = nsd, xil = 0, ur = qnorm(0.9, nmean, nsd),
sigmaur = nsd, xir = 0, lower.tail = TRUE)
ritmgng(n = 1, nmean = 0, nsd = 1, epsilon = sd, ul = qnorm(0.1,
nmean, nsd), sigmaul = nsd, xil = 0, ur = qnorm(0.9, nmean, nsd),
sigmaur = nsd, xir = 0)
quantiles
normal mean
normal standard deviation (positive)
interval half-width
lower tail threshold
lower tail GPD scale parameter (positive)
lower tail GPD shape parameter
upper tail threshold
upper tail GPD scale parameter (positive)
upper tail GPD shape parameter
logical, if TRUE then log density
quantiles
logical, if FALSE then upper tail probabilities
cumulative probabilities
sample size (positive integer)
ditmgng
gives the density,
pitmgng
gives the cumulative distribution function,
qitmgng
gives the quantile function and
ritmgng
gives a random sample.
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
The cumulative distribution function is defined by
pnorm(x, nmean, nsd)
.
The conditional GPD for the upper tail has cdf pgpd(x, ur, sigmaur, xir)
and lower tail cdf 1 - pgpd(-x, -ul, sigmaul, xil)
. The truncated
normal is not renormalised to be proper, so pnorm(ur, nmean, nsd) - pnorm(ul, nmean, nsd)
to the cdf
for all 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 qmix
for a given 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 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.
http://en.wikipedia.org/wiki/Normal_distribution
http://en.wikipedia.org/wiki/Generalized_Pareto_distribution
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
Other itmgng: fitmgng
Other gng: fgngcon
, fgng
,
fitmgng
, fnormgpd
,
gngcon
, gng
,
normgpd
Other itmnormgpd: fitmgng
,
fitmnormgpd
, itmnormgpd
# NOT RUN {
set.seed(1)
par(mfrow = c(2, 2))
xx = seq(-5, 5, 0.01)
ul = -1.5;ur = 2
epsilon = 0.8
kappa = 1/(2 + pnorm(ur, 0, 1) - pnorm(ul, 0, 1))
f = ditmgng(xx, nmean = 0, nsd = 1, epsilon, ul, sigmaul = 1, xil = 0.5, ur, sigmaur = 1, xir = 0.5)
plot(xx, f, ylim = c(0, 0.5), xlim = c(-5, 5), type = 'l', lwd = 2, xlab = "x", ylab = "density")
lines(xx, kappa * dgpd(-xx, -ul, sigmau = 1, xi = 0.5), col = "blue", lty = 2, lwd = 2)
lines(xx, kappa * dnorm(xx, 0, 1), col = "red", lty = 2, lwd = 2)
lines(xx, kappa * dgpd(xx, ur, sigmau = 1, xi = 0.5), col = "green", lty = 2, lwd = 2)
abline(v = ul + epsilon * seq(-1, 1), lty = c(2, 1, 2), col = "blue")
abline(v = ur + epsilon * seq(-1, 1), lty = c(2, 1, 2), col = "green")
legend('topright', c('Normal-GPD ITM', 'kappa*GPD Lower', 'kappa*Normal', 'kappa*GPD Upper'),
col = c("black", "blue", "red", "green"), lty = c(1, 2, 2, 2), lwd = 2)
# cdf contributions
F = pitmgng(xx, nmean = 0, nsd = 1, epsilon, ul, sigmaul = 1, xil = 0.5, ur, sigmaur = 1, xir = 0.5)
plot(xx, F, ylim = c(0, 1), xlim = c(-5, 5), type = 'l', lwd = 2, xlab = "x", ylab = "cdf")
lines(xx[xx < ul], kappa * (1 - pgpd(-xx[xx < ul], -ul, 1, 0.5)), col = "blue", lty = 2, lwd = 2)
lines(xx[(xx >= ul) & (xx <= ur)], kappa * (1 + pnorm(xx[(xx >= ul) & (xx <= ur)], 0, 1) -
pnorm(ul, 0, 1)), col = "red", lty = 2, lwd = 2)
lines(xx[xx > ur], kappa * (1 + (pnorm(ur, 0, 1) - pnorm(ul, 0, 1)) +
pgpd(xx[xx > ur], ur, sigmau = 1, xi = 0.5)), col = "green", lty = 2, lwd = 2)
abline(v = ul + epsilon * seq(-1, 1), lty = c(2, 1, 2), col = "blue")
abline(v = ur + epsilon * seq(-1, 1), lty = c(2, 1, 2), col = "green")
legend('topleft', c('Normal-GPD ITM', 'kappa*GPD Lower', 'kappa*Normal', 'kappa*GPD Upper'),
col = c("black", "blue", "red", "green"), lty = c(1, 2, 2, 2), lwd = 2)
# simulated data density histogram and overlay true density
x = ritmgng(10000, nmean = 0, nsd = 1, epsilon, ul, sigmaul = 1, xil = 0.5,
ur, sigmaur = 1, xir = 0.5)
hist(x, freq = FALSE, breaks = seq(-1000, 1000, 0.1), xlim = c(-5, 5))
lines(xx, ditmgng(xx, nmean = 0, nsd = 1, epsilon, ul, sigmaul = 1, xil = 0.5,
ur, sigmaur = 1, xir = 0.5), lwd = 2, col = 'black')
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab