Description Usage Arguments Details Value Note Author(s) References See Also Examples
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 with continuity at the lower and upper thresholds.
The parameters are the normal mean
nmean
and standard deviation nsd
, lower tail (threshold ul
,
GPD shape xil
and tail fraction phiul
)
and upper tail (threshold ur
, GPD shape
xiR
and tail fraction phiuR
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | dgngcon(x, nmean = 0, nsd = 1, ul = qnorm(0.1, nmean, nsd),
xil = 0, phiul = TRUE, ur = qnorm(0.9, nmean, nsd), xir = 0,
phiur = TRUE, log = FALSE)
pgngcon(q, nmean = 0, nsd = 1, ul = qnorm(0.1, nmean, nsd),
xil = 0, phiul = TRUE, ur = qnorm(0.9, nmean, nsd), xir = 0,
phiur = TRUE, lower.tail = TRUE)
qgngcon(p, nmean = 0, nsd = 1, ul = qnorm(0.1, nmean, nsd),
xil = 0, phiul = TRUE, ur = qnorm(0.9, nmean, nsd), xir = 0,
phiur = TRUE, lower.tail = TRUE)
rgngcon(n = 1, nmean = 0, nsd = 1, ul = qnorm(0.1, nmean, nsd),
xil = 0, phiul = TRUE, ur = qnorm(0.9, nmean, nsd), xir = 0,
phiur = TRUE)
|
x |
quantiles |
nmean |
normal mean |
nsd |
normal standard deviation (positive) |
ul |
lower tail threshold |
xil |
lower tail GPD shape parameter |
phiul |
probability of being below lower threshold [0, 1] or |
ur |
upper tail threshold |
xir |
upper tail GPD shape parameter |
phiur |
probability of being above upper threshold [0, 1] or |
log |
logical, if TRUE then log density |
q |
quantiles |
lower.tail |
logical, if FALSE then upper tail probabilities |
p |
cumulative probabilities |
n |
sample size (positive integer) |
Extreme value mixture model combining normal distribution for the bulk
between the lower and upper thresholds and GPD for upper and lower tails with Continuity Constraints at the lower and upper threshold. The
user can pre-specify phiul
and phiur
permitting a parameterised
value for the lower and upper tail fraction respectively. Alternatively, when
phiul=TRUE
or phiur=TRUE
the corresponding tail fraction is
estimated as from the normal bulk model.
Notice that the tail fraction cannot be 0 or 1, and the sum of upper and lower tail
fractions phiul+phiur<1
, so the lower threshold must be less than the upper,
ul<ur
.
The cumulative distribution function now has three components. The lower tail with
tail fraction φ_{ul} defined by the normal bulk model (phiul=TRUE
)
upto the lower threshold x < u_l:
F(x) = H(u_l) G_l(x).
where H(x) is the normal cumulative distribution function (i.e.
pnorm(ur, nmean, nsd)
). The
G_l(X) is the conditional GPD cumulative distribution function with negated
data and threshold, i.e. dgpd(-x, -ul, sigmaul, xil, phiul)
. The normal
bulk model between the thresholds u_l ≤ x ≤ u_r given by:
F(x) = H(x).
Above the threshold x > u_r the usual conditional GPD:
F(x) = H(u_r) + [1 - H(u_r)] G(x)
where G(X).
The cumulative distribution function for the pre-specified tail fractions φ_{ul} and φ_{ur} is more complicated. The unconditional GPD is used for the lower tail x < u_l:
F(x) = φ_{ul} G_l(x).
The normal bulk model between the thresholds u_l ≤ x ≤ u_r given by:
F(x) = φ_{ul}+ (1-φ_{ul}-φ_{ur}) (H(x) - H(u_l)) / (H(u_r) - H(u_l)).
Above the threshold x > u_r the usual conditional GPD:
F(x) = (1-φ_{ur}) + φ_{ur} G(x)
Notice that these definitions are equivalent when φ_{ul} = H(u_l) and φ_{ur} = 1 - H(u_r).
The continuity constraint at ur
means that:
φ_{ur} g_r(x) = (1-φ_{ul}-φ_{ur}) h(u_r)/ (H(u_r) - H(u_l)).
By rearrangement, the GPD scale parameter sigmaur
is then:
σ_ur = φ_{ur} (H(u_r) - H(u_l))/ h(u_r) (1-φ_{ul}-φ_{ur}).
where h(x), g_l(x) and g_r(x) are the normal and conditional GPD density functions for lower and upper tail respectively. In the special case of where the tail fraction is defined by the bulk model this reduces to
σ_ur = [1-H(u_r)] / h(u_r)
.
The continuity constraint at ul
means that:
φ_{ul} g_l(x) = (1-φ_{ul}-φ_{ur}) h(u_l)/ (H(u_r) - H(u_l)).
The GPD scale parameter sigmaul
is replaced by:
σ_ul = φ_{ul} (H(u_r) - H(u_l))/ h(u_l) (1-φ_{ul}-φ_{ur}).
In the special case of where the tail fraction is defined by the bulk model this reduces to
σ_ul = H(u_l)/ h(u_l)
.
See gpd
for details of GPD upper tail component,
dnorm
for details of normal bulk component,
dnormgpd
for normal with GPD extreme value
mixture model and dgng
for normal bulk with GPD
upper and lower tails extreme value mixture model.
dgngcon
gives the density,
pgngcon
gives the cumulative distribution function,
qgngcon
gives the quantile function and
rgngcon
gives a random sample.
All inputs are vectorised except log
and lower.tail
.
The main inputs (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
rgngcon
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
rgngcon
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.
Yang Hu and Carl Scarrott carl.scarrott@canterbury.ac.nz
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
Zhao, X., Scarrott, C.J. Reale, M. and Oxley, L. (2010). Extreme value modelling for forecasting the market crisis. Applied Financial Econometrics 20(1), 63-72.
Other normgpd: fgng
, fhpd
,
fitmnormgpd
, flognormgpd
,
fnormgpdcon
, fnormgpd
,
gng
, hpdcon
,
hpd
, itmnormgpd
,
lognormgpdcon
, lognormgpd
,
normgpdcon
, normgpd
Other normgpdcon: fgngcon
,
fhpdcon
, flognormgpdcon
,
fnormgpdcon
, fnormgpd
,
gng
, hpdcon
,
hpd
, normgpdcon
,
normgpd
Other gng: fgngcon
, fgng
,
fitmgng
, fnormgpd
,
gng
, itmgng
,
normgpd
Other gngcon: fgngcon
, fgng
,
fnormgpdcon
, gng
,
normgpdcon
Other fgngcon: fgngcon
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
set.seed(1)
par(mfrow = c(2, 2))
x = rgngcon(1000, phiul = 0.15, phiur = 0.15)
xx = seq(-6, 6, 0.01)
hist(x, breaks = 100, freq = FALSE, xlim = c(-6, 6))
lines(xx, dgngcon(xx, phiul = 0.15, phiur = 0.15))
# three tail behaviours
plot(xx, pgngcon(xx), type = "l")
lines(xx, pgngcon(xx, xil = 0.3, xir = 0.3), col = "red")
lines(xx, pgngcon(xx, xil = -0.3, xir = -0.3), col = "blue")
legend("topleft", paste("Symmetric xil=xir=",c(0, 0.3, -0.3)),
col=c("black", "red", "blue"), lty = 1)
x = rgngcon(1000, xil = -0.3, phiul = 0.2, xir = 0.3, phiur = 0.2)
xx = seq(-6, 6, 0.01)
hist(x, breaks = 100, freq = FALSE, xlim = c(-6, 6))
lines(xx, dgngcon(xx, xil = -0.3, phiul = 0.2, xir = 0.3, phiur = 0.2))
plot(xx, dgngcon(xx, xil = -0.3, phiul = 0.2, xir = 0.3, phiur = 0.2), type = "l", ylim = c(0, 0.4))
lines(xx, dgngcon(xx, xil = -0.3, phiul = 0.3, xir = 0.3, phiur = 0.3), col = "red")
lines(xx, dgngcon(xx, xil = -0.3, phiul = TRUE, xir = 0.3, phiur = TRUE), col = "blue")
legend("topleft", c("phiul = phiur = 0.2", "phiul = phiur = 0.3", "Bulk Tail Fraction"),
col=c("black", "red", "blue"), lty = 1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.