Description Usage Arguments Details Value Acknowledgments Note Author(s) References See Also Examples
Maximum likelihood estimation for fitting the extreme value mixture model with normal for bulk distribution between thresholds and conditional GPDs beyond thresholds. With options for profile likelihood estimation for both thresholds and fixed threshold approach.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | fgng(x, phiul = TRUE, phiur = TRUE, ulseq = NULL, urseq = NULL,
fixedu = FALSE, pvector = NULL, std.err = TRUE, method = "BFGS",
control = list(maxit = 10000), finitelik = TRUE, ...)
lgng(x, nmean = 0, nsd = 1, ul = 0, sigmaul = 1, xil = 0,
phiul = TRUE, ur = 0, sigmaur = 1, xir = 0, phiur = TRUE,
log = TRUE)
nlgng(pvector, x, phiul = TRUE, phiur = TRUE, finitelik = FALSE)
proflugng(ulr, pvector, x, phiul = TRUE, phiur = TRUE,
method = "BFGS", control = list(maxit = 10000), finitelik = TRUE,
...)
nlugng(pvector, ul, ur, x, phiul = TRUE, phiur = TRUE,
finitelik = FALSE)
|
x |
vector of sample data |
phiul |
probability of being below lower threshold (0, 1) or logical, see Details in
help for |
phiur |
probability of being above upper threshold (0, 1) or logical, see Details in
help for |
ulseq |
vector of lower thresholds (or scalar) to be considered in profile likelihood or
|
urseq |
vector of upper thresholds (or scalar) to be considered in profile likelihood or
|
fixedu |
logical, should threshold be fixed (at either scalar value in |
pvector |
vector of initial values of parameters or |
std.err |
logical, should standard errors be calculated |
method |
optimisation method (see |
control |
optimisation control list (see |
finitelik |
logical, should log-likelihood return finite value for invalid parameters |
... |
optional inputs passed to |
nmean |
scalar normal mean |
nsd |
scalar normal standard deviation (positive) |
ul |
scalar lower tail threshold |
sigmaul |
scalar lower tail GPD scale parameter (positive) |
xil |
scalar lower tail GPD shape parameter |
ur |
scalar upper tail threshold |
sigmaur |
scalar upper tail GPD scale parameter (positive) |
xir |
scalar upper tail GPD shape parameter |
log |
logical, if |
ulr |
vector of length 2 giving lower and upper tail thresholds or
|
The extreme value mixture model with normal bulk and GPD for both tails is fitted to the entire dataset using maximum likelihood estimation. The estimated parameters, variance-covariance matrix and their standard errors are automatically output.
See help for fnormgpd
for details, type help fnormgpd
.
Only the different features are outlined below for brevity.
The full parameter vector is
(nmean
, nsd
, ul
, sigmaul
, xil
, ur
, sigmaur
, xir
)
if thresholds are also estimated and
(nmean
, nsd
, sigmaul
, xil
, sigmaur
, xir
)
for profile likelihood or fixed threshold approach.
The tail fractions phiul
and phiur
are treated separately to the other parameters,
to allow for all their representations. In the fitting functions
fgng
and
proflugng
they are logical:
default values phiul=TRUE
and phiur=TRUE
- tail fractions specified by
normal distribution pnorm(ul, nmean, nsd)
and survivior functions
1-pnorm(ur, nmean, nsd)
respectively and standard error is output as NA
.
phiul=FALSE
and phiur=FALSE
- treated as extra parameters estimated using
the MLE which is the sample proportion beyond the thresholds and
standard error is output.
In the likelihood functions lgng
,
nlgng
and nlugng
it can be logical or numeric:
logical - same as for fitting functions with default values phiul=TRUE
and phiur=TRUE
.
numeric - any value over range (0, 1). Notice that the tail
fraction probability cannot be 0 or 1 otherwise there would be no
contribution from either tail or bulk components respectively. Also,
phiul+phiur<1
as bulk must contribute.
If the profile likelihood approach is used, then a grid search over all combinations of both thresholds is carried out. The combinations which lead to less than 5 in any datapoints beyond the thresholds are not considered.
Log-likelihood is given by lgng
and it's
wrappers for negative log-likelihood from nlgng
and nlugng
. Profile likelihood for both
thresholds given by proflugng
. Fitting function
fgng
returns a simple list with the
following elements
call : | optim call |
x : | data vector x |
init : | pvector |
fixedu : | fixed thresholds, logical |
ulseq : | lower threshold vector for profile likelihood or scalar for fixed threshold |
urseq : | upper threshold vector for profile likelihood or scalar for fixed threshold |
nllhuseq : | profile negative log-likelihood at each threshold pair in (ulseq, urseq) |
optim : | complete optim output |
mle : | vector of MLE of parameters |
cov : | variance-covariance matrix of MLE of parameters |
se : | vector of standard errors of MLE of parameters |
rate : | phiu to be consistent with evd |
nllh : | minimum negative log-likelihood |
n : | total sample size |
nmean : | MLE of normal mean |
nsd : | MLE of normal standard deviation |
ul : | lower threshold (fixed or MLE) |
sigmaul : | MLE of lower tail GPD scale |
xil : | MLE of lower tail GPD shape |
phiul : | MLE of lower tail fraction (bulk model or parameterised approach) |
se.phiul : | standard error of MLE of lower tail fraction |
ur : | upper threshold (fixed or MLE) |
sigmaur : | MLE of upper tail GPD scale |
xir : | MLE of upper tail GPD shape |
phiur : | MLE of upper tail fraction (bulk model or parameterised approach) |
se.phiur : | standard error of MLE of upper tail fraction |
See Acknowledgments in
fnormgpd
, type help fnormgpd
. Based on code
by Xin Zhao produced for MATLAB.
When pvector=NULL
then the initial values are:
MLE of normal parameters assuming entire population is normal; and
lower threshold 10% quantile (not relevant for profile likelihood for threshold or fixed threshold approaches);
upper threshold 90% quantile (not relevant for profile likelihood for threshold or fixed threshold approaches);
MLE of GPD parameters beyond threshold.
Yang Hu and Carl Scarrott carl.scarrott@canterbury.ac.nz
http://www.math.canterbury.ac.nz/~c.scarrott/evmix
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
Hu, Y. (2013). Extreme value mixture modelling: An R package and simulation study. MSc (Hons) thesis, University of Canterbury, New Zealand. http://ir.canterbury.ac.nz/simple-search?query=extreme&submit=Go
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.
Mendes, B. and H. F. Lopes (2004). Data driven estimates for mixtures. Computational Statistics and Data Analysis 47(3), 583-598.
Other normgpd: fhpd
,
fitmnormgpd
, flognormgpd
,
fnormgpdcon
, fnormgpd
,
gngcon
, gng
,
hpdcon
, hpd
,
itmnormgpd
, lognormgpdcon
,
lognormgpd
, normgpdcon
,
normgpd
Other gng: fgngcon
, fitmgng
,
fnormgpd
, gngcon
,
gng
, itmgng
,
normgpd
Other gngcon: fgngcon
,
fnormgpdcon
, gngcon
,
gng
, normgpdcon
Other fgng: gng
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | ## Not run:
set.seed(1)
par(mfrow = c(2, 1))
x = rnorm(1000)
xx = seq(-4, 4, 0.01)
y = dnorm(xx)
# Bulk model based tail fraction
fit = fgng(x)
hist(x, breaks = 100, freq = FALSE, xlim = c(-4, 4))
lines(xx, y)
with(fit, lines(xx, dgng(xx, nmean, nsd, ul, sigmaul, xil, phiul,
ur, sigmaur, xir, phiur), col="red"))
abline(v = c(fit$ul, fit$ur), col = "red")
# Parameterised tail fraction
fit2 = fgng(x, phiul = FALSE, phiur = FALSE)
with(fit2, lines(xx, dgng(xx, nmean, nsd, ul, sigmaul, xil, phiul,
ur, sigmaur, xir, phiur), col="blue"))
abline(v = c(fit2$ul, fit2$ur), col = "blue")
legend("topright", c("True Density","Bulk Tail Fraction","Parameterised Tail Fraction"),
col=c("black", "red", "blue"), lty = 1)
# Profile likelihood for initial value of threshold and fixed threshold approach
fitu = fgng(x, ulseq = seq(-2, -0.2, length = 10),
urseq = seq(0.2, 2, length = 10))
fitfix = fgng(x, ulseq = seq(-2, -0.2, length = 10),
urseq = seq(0.2, 2, length = 10), fixedu = TRUE)
hist(x, breaks = 100, freq = FALSE, xlim = c(-4, 4))
lines(xx, y)
with(fit, lines(xx, dgng(xx, nmean, nsd, ul, sigmaul, xil, phiul,
ur, sigmaur, xir, phiur), col="red"))
abline(v = c(fit$ul, fit$ur), col = "red")
with(fitu, lines(xx, dgng(xx, nmean, nsd, ul, sigmaul, xil, phiul,
ur, sigmaur, xir, phiur), col="purple"))
abline(v = c(fitu$ul, fitu$ur), col = "purple")
with(fitfix, lines(xx, dgng(xx, nmean, nsd, ul, sigmaul, xil, phiul,
ur, sigmaur, xir, phiur), col="darkgreen"))
abline(v = c(fitfix$ul, fitfix$ur), col = "darkgreen")
legend("topright", c("True Density","Default initial value (90% quantile)",
"Prof. lik. for initial value", "Prof. lik. for fixed threshold"),
col=c("black", "red", "purple", "darkgreen"), lty = 1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.