Learn R Programming

evmix (version 1.0)

fgngcon: MLE Fitting of Normal Bulk with GPD Upper and Lower Tails Extreme Value Mixture Model with Continuity Constraints

Description

Maximum likelihood estimation for the extreme value mixture model with normal for bulk distribution between the lower and upper thresholds with conditional GPD for the two tails with continuity constraints

Usage

fgngcon(x, phiul = TRUE, phiur = TRUE, pvector = NULL,
    std.err = TRUE, method = "BFGS",
    control = list(maxit = 10000), finitelik = TRUE, ...)

Arguments

x
vector of sample data
phiul
logical
phiur
logical
pvector
vector of initial values of mixture model parameters or NULL
std.err
logical, should standard errors be calculated
method
optimisation method (see optim)
control
optimisation control list (see optim)
finitelik
logical, should log-likelihood return finite value for invalid parameters
...
optional inputs passed to optim

Value

  • Returns a simple list with the following elements ll{ x: data vector x init: pvector optim: complete optim output mle: vector of MLE of model parameters cov: variance-covariance matrix of MLE of model parameters se: vector of standard errors of MLE of model parameters rate: phiu to be consistent with evd nllh: minimum negative log-likelihood allparams: vector of MLE of model parameters, including sigmaul, sigmaur and tail fractions phiul and phiur allse: vector of standard error of model parameters, including sigmaul, sigmaurand tail fractions phiul and phiur n: total sample size nmean: MLE of normal mean nsd: MLE of normal standard deviation ul: lower threshold sigmaul: MLE of lower tail GPD scale xil: MLE of lower tail GPD shape phiul: MLE of lower tail fraction ur: upper threshold sigmaur: MLE of upper tail GPD scale xir: MLE of upper tail GPD shape phiur: MLE of upper tail fraction } The output list has some duplicate entries and repeats some of the inputs to both provide similar items to those from fpot and to make it as useable as possible.

Details

The extreme value mixture model with normal bulk and GPD for both tails with continuity constraints is fitted to the entire dataset using maximum likelihood estimation. The estimated parameters, variance-covariance matrix and their standard errors are automatically output. pvector is (nmean, nsd, ul, sigmaul, xil, ur, sigmaur, xir) The default values for phiul=TRUE and phiur=TRUE so that the corresponding tail fractions are specified by normal distribution $\phi_{ul} = H(u_l)$ and $\phi_{ur} = 1 - H(u_r)$. When phiul=FALSE and phiur=FALSE then the corresponding tail fractions are treated as an extra parameter estimated using the MLE which is the sample proportion beyond the corresponding threshold. In this case the standard error for phiul and phiur are estimated and output as sephiul and sephiur. Missing values (NA and NaN) are assumed to be invalid data so are ignored, which is inconsistent with the evd library which assumes the missing values are below the threshold. The default optimisation algorithm is "BFGS", which requires a finite negative log-likelihood function evaluation finitelik=TRUE. For invalid parameters, a zero likelihood is replaced with exp(-1e6). The "BFGS" optimisation algorithms require finite values for likelihood, so any user input for finitelik will be overridden and set to finitelik=TRUE if either of these optimisation methods is chosen. It will display a warning for non-zero convergence result comes from optim function call. If the hessian is of reduced rank then the variance covariance (from inverse hessian) and standard error of parameters cannot be calculated, then by default std.err=TRUE and the function will stop. If you want the parameter estimates even if the hessian is of reduced rank (e.g. in a simulation study) then set std.err=FALSE.

References

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.

See Also

fgng, fnormgpd, lgpd and gpd Other gngcon: dgngcon, gngcon, lgngcon, nlgngcon, pgngcon, qgngcon, rgngcon

Examples

Run this code
par(mfrow=c(2,2))
x = rnorm(1000)
xx = seq(-6, 6, 0.01)
y = dnorm(xx)

# Bulk model base tail fraction
fit = fgngcon(x, phiul = TRUE, phiur = TRUE, std.err = FALSE)
hist(x, breaks = 100, freq = FALSE, xlim = c(-6, 6), main = "N(0, 1)")
lines(xx, y)
lines(xx, dgngcon(xx, nmean = fit$nmean, nsd = fit$nsd,
  ul = fit$ul, xil = fit$xil, phiul = TRUE,
  ur = fit$ur, xir = fit$xir, phiur = TRUE), col="red")
abline(v = c(fit$ul, fit$ur))

# Parameterised tail fraction
fit2 = fgngcon(x, phiul = TRUE, phiur = TRUE, std.err = FALSE)
plot(xx, y, type = "l")
lines(xx, dgngcon(xx, nmean = fit$nmean, nsd = fit$nsd,
  ul = fit$ul, xil = fit$xil, phiul = TRUE,
  ur = fit$ur, xir = fit$xir, phiur = TRUE), col="red")
lines(xx, dgngcon(xx, nmean = fit2$nmean, nsd = fit2$nsd,
  ul = fit2$ul, xil = fit2$xil, phiul = fit2$phiul,
  ur = fit2$ur, xir = fit2$xir, phiur = fit2$phiur), col="blue")
abline(v = c(fit$ul, fit$ur), col = "red")
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)
x = rnorm(1000)
xx = seq(-6, 6, 0.01)
y = dnorm(xx)

# Two tail is safest if bulk has lower tail which is not normal tail
x = rt(1000, df = 3)
xx = seq(-10, 10, 0.01)
y = dt(xx, df = 3)

# Bulk model base tail fraction
fit = fnormgpd(x, phiu = FALSE, std.err = FALSE)
fit2 = fgngcon(x, phiul = FALSE, phiur = FALSE, std.err = FALSE)
hist(x, breaks = 100, freq = FALSE, xlim = c(-10, 10), main = "t (df=3)")
lines(xx, y)
lines(xx, dnormgpd(xx, nmean = fit$nmean, nsd = fit$nsd,
  u = fit$u, sigmau = fit$sigmau, xi = fit$xi, phiu = fit$phiu), col="red")
abline(v = fit$u)

# Bulk model base tail fraction
plot(xx, y, type = "l")
lines(xx, dnormgpd(xx, nmean = fit$nmean, nsd = fit$nsd,
  u = fit$u, sigmau = fit$sigmau, xi = fit$xi, phiu = fit$phiu), col="red")
lines(xx, dgngcon(xx, nmean = fit2$nmean, nsd = fit2$nsd,
  ul = fit2$ul, xil = fit2$xil, phiul = fit2$phiul,
  ur = fit2$ur, xir = fit2$xir, phiur = fit2$phiur), col="blue")
abline(v = c(fit$ul, fit$ur), col = "red")
abline(v = c(fit2$ul, fit2$ur), col = "blue")
legend("topright", c("True Density","GPD Upper Tail Only","GPD Both Tails"),
  col=c("black", "red", "blue"), lty = 1)

Run the code above in your browser using DataLab