evm: Extreme value modelling

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/evm.R


Likelihood based modelling and inference for extreme value models, possibly with explanatory variables.


evm(y, data, family = gpd, ...)

## Default S3 method:
evm(y, data, family = gpd, th = -Inf, qu, ...,
  penalty = NULL, prior = "gaussian", method = "optimize",
  cov = "observed", start = NULL, priorParameters = NULL, maxit = 10000,
  trace = NULL, iter = 40500, burn = 500, thin = 4,
  proposal.dist = c("gaussian", "cauchy"), jump.cov, jump.const = NULL,
  R = 1000, cores = NULL, verbose = TRUE)



Either a numeric vector or the name of a variable in data.


A data frame containing y and any covariates.


An object of class 'texmexFamily'. Defaults to family=gpd and a generalized Pareto distribution is fit to the data. Alternatively the family could be gev, resulting in a generalized extreme value distribution being fit. No other families are currently available in texmex, but users may write their own.


In evm, formulae for the parameters in the family, e.g. phi = ~ x. If none are specified, they all default to ~1.


For threshold excess models (such as when family=gpd), the threshold for y, exceedances above which will be used to fit the upper tail model. Note that if you have already thresholded your data and want to model all of y, you still need to specify th.


An alternative to th, a probability defined such that quantile(y,qu) equals th.


How to penalize the likelhood. Currently, either "none"", "gaussian"" or "lasso"" are the only allowed values. If penalty is "gaussian" or "lasso" then the parameters for the penalization are specified through the priorParameters argument. See below. Defaults to penalty=NULL and applies maximum likelihood estimation.


If method = "optimize", just an alternative way of specifying the penalty, and only one or neither of penalty and prior should be given. If method = "simulate", prior must be "gaussian" because no other prior distributions have been implemented.


Should be either "optimize" (the default), "simulate" or "bootstrap". The first letter or various abbreviations will do. If 'optimize' is used, the (penalized) likelihood is directly optimized using optim and point estimates (either ML or MAP estimates) are returned with other information. If "simulate", a Metropolis algorithm is used to simulate from the joint posterior distribution of the parameters. If "bootstrap", a parametric boostrap is performed.


How to compute the covariance matrix of the parameters. Defaults to cov = "observed" in which case the observed information matrix is used, if the info element of the texmexFamily object is present. Note that currently, this is not implemented for gev. Alternatives are cov = "numeric" in which case a numerical approximation of the Hessian is used (see the help for optim), or cov = "sandwich" if the sandwich element of the texmexFamily object is implemented. The cov = "sandwich" method implements the Huber sandwich correction to the covariance matrix for data which are not independent and in which case the likelihood function no longer has the interpretation of a joint likelihood, but instead should be interpreted as a pseudo-likelihod.

In some cases, particularly with small samples, the numerical approximation can be quite different from the closed form (cov="observed") result, and the value derived from the observed information should be preferred. However, in either case, since the underlying log-likelihood may be far from quadratic for small samples, the resulting estimates of standard errors are liable to approximate poorly the true standard errors. Also see the comments in the Details section, below.


Starting values for the parameters, to be passed to optim. If not provided, the function will use the start element of the texmexFamily object if it exists.


A list with two components. The first should be a vector of means, the second should be a covariance matrix if the penalty/prior is "gaussian" or "quadratic" and a diagonal precision matrix if the penalty/prior is "lasso", "L1" or "Laplace". If method = "simulate" then these represent the parameters in the Gaussian prior distribution. If method = 'optimize' then these represent the parameters in the penalty function. If not supplied: all default prior means are zero; all default prior variances are 10^4; all covariances are zero.


The number of iterations allowed in optim.


Whether or not to print progress to screen. If method = "optimize", the argument is passed into optim – see the help for that function. If method = "simulate", the argument determines at how many steps of the Markov chain the function should tell the user, and in this case it defaults to trace = 10000.


Number of simulations to generate under method = "simulate". Defaults to 40500.


The number of initial steps to be discarded. Defaults to 500.


The degree of thinning of the resulting Markov chains. Defaults to 4 (one in every 4 steps is retained).


The proposal distribution to use, either multivariate gaussian or a multivariate Cauchy.


Covariance matrix for proposal distribution of Metropolis algorithm. This is scaled by jump.const.


Control parameter for the Metropolis algorithm.


The number of parametric bootstrap samples to run when method = "bootstrap" is requested. Defaults to 1000.


The number of cores to use when bootstrapping. Defaults to cores=NULL and the function guesses how many cores are available and uses them all.


Whether or not to print progress to screen. Defaults to verbose=TRUE.


The main modelling function is evm (extreme value model) and the distribution to be used is specified by passing an object of class texmexFamily to the family argument.

The default texmexFamily object used by evm is gpd. Currently, the other texmexFamily objects available are gev which results in fitting a generalized extreme value (GEV) distribution to the data, and egp3 which fits the extended generalized Pareto distribution version 3 of Papastathopoulos and Tawn (2013).

See Coles (2001) for an introduction to extreme value modelling and the GPD and GEV models.

For the GPD model, we use the following parameterisation of evm:

P(Y ≤ y) = 1 - ≤ft(1 + \frac{ξ y}{σ}\right)^{-1/ξ}

for y ≥ 0 and 1 + ξ y / σ ≥ 0.

For the GEV model, we use:

P(Y ≤ y) = \exp ≤ft\{ -≤ft[ 1 + ξ ≤ft( \frac{y - μ}{σ}\right) \right] ^{-1/ξ} \right\}

In each case, the scale parameter is sigma (σ) and the shape parameter is xi (ξ). The GEV distribution also has location parameter mu (μ). See Papastathopoulos and Tawn (2013) for specification of the EGP3 model.

Working with the log of the scale parameter improves the stability of computations, makes a quadratic penalty more appropriate and enables the inclusion of covariates in the model for the scale parameter, which must remain positive. We therefore work with φ=log(σ). All specification of priors or penalty functions refer to φ rather than σ. A quadratic penalty can be thought of as a Gaussian prior distribution, whence the terminology of the function.

Parameters of the evm are estimated by using maximum (penalized) likelihood (method = "optimize"), or by simulating from the posterior distribution of the model parameters using a Metropolis algorithm (method = "simulate"). In the latter case, start is used as a starting value for the Metropolis algorithm; in its absence, the maximum penalized likelhood point estimates are computed and used.

A boostrap approach is also available (method = "bootstrap"). This runs a parametric bootstrap, simulating from the model fit by optimization.

When method = "simulate" the print and summary functions give posterior means and standard deviations. Posterior means are also returned by the coef method. Depending on what you want to do and what the posterior distributions look like (use plot method) you might want to work with quantiles of the posterior distributions instead of relying on standard errors.

When method = "bootstrap", summaries of the bootstrap distribution and the bootstrap estimate of bias are displayed.


If method = "optimize", an object of class evmOpt:


The call to evmSim that produced the object.


The original data (above and below the threshold for fitting if a distribution for threshold excesses has been used). In detail, data is a list with elements y and D. y is the response variable and D is a list containing the design matrices implied by any formlae used in the call to evm.


Output from optim relating to whether or not the optimizer converged.


A message telling the user whether or not convergence was achieved.


The threshold of the data above which the evmSim model was fit.


The type of penalty function used, if any.


The parameter estimates as computed under maximum likelihood or maximum penalized likelihood.


The proportion of observations above the threshold. If the model is not a threshold exceedance model (e.g. the GEV model), the rate will be 1.


See above.


Residuals computed using the residual function in the texmexFamily object, if any.


The value of the optimized penalized log-likelihood.


The value of the optimized (unpenalized) log-likelihood. If penalty='none' is used, this will be identical to ploglik, above.


The estimated covariance of the parameters in the model.


The estimated standard errors of the parameters in the model.


A named list containing a named list for each design matrix (main parameter) in the model. Each list contians an element named after each factor in the linear predictor for the respective design matrix. These are used by the predict method to ensure all factor levels are known, even if they don't appear in newdata.

If method = "simulate", an object of class evmSim:


The call to evmSim that produced the object.


The threshold above which the model was fit.


The point estimates found by maximum penalized likelihood and which were used as the starting point for the Markov chain. This is of class evmOpt and methods for this class (such as resid and plot) may be useful.


The number of steps of the Markov chain that are to be treated as the burn-in and not used in inferences.


The degree of thinning used.


The entire Markov chain generated by the Metropolis algorithm.


The response data above the threshold for fitting.


The seed used by the random number generator.


The remainder of the chain after deleting the burn-in and applying any thinning.

If method = "bootstrap", an object of class evmBoot:


The call to evmBoot that produced the object.


The parameter estimates from the bootstrap fits.


The fit by by maximum penalized likelihood to the orginal data. This is of class evmOpt and methods for this class (such as resid and plot) may be useful.

There are summary, plot, print, residuals and coefficients methods available for these classes.


For both GPD and GEV models, when there are estimated values of ξ ≤ -0.5, the regularity conditions of the likelihood break down and inference based on approximate standard errors cannot be performed. In this case, the most fruitful approach to inference appears to be by the bootstrap. It might be possible to simulate from the posterior, but finding a good proposal distribution might be difficult and you should take care to get an acceptance rate that is reasonably high (around 40% when there are no covariates, lower otherwise).


Janet E. Heffernan, Harry Southworth. Some of the internal code is based on the gpd.fit function in the ismev package and is due to Stuart Coles.


S. Coles. An Introduction to Statistical Modelling of Extreme Values. Springer, 2001.

I. Papastathopoulos and J. A. Tawn, Extended generalised Pareto models for tail estimation, Journal of Statistical Planning and Inference, 143, 131 - 143, 2013.

See Also

rl.evmOpt, predict.evmOpt, evm.declustered.


  mod <- evm(rain, th=30)
  par(mfrow=c(2, 2))

#  mod <- evm(rain, th=30, method="sim")
#  par(mfrow=c(3, 2))
#  plot(mod)

  mod <- evm(SeaLevel, data=portpirie, family=gev)

#  mod <- evm(SeaLevel, data=portpirie, family=gev, method="sim")
#  par(mfrow=c(3, 3))
#  plot(mod)

texmex documentation built on May 19, 2017, 4:39 p.m.

Search within the texmex package
Search all R packages, documentation and source code