0% found this document useful (0 votes)
2 views33 pages

evir

The 'evir' package in R provides functions for extreme value theory, including exploratory data analysis and various statistical distributions. It contains datasets such as daily log returns on BMW share prices and large fire insurance claims in Denmark. The package is maintained by Bernhard Pfaff and is available on CRAN.

Uploaded by

roziyoussouf8
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views33 pages

evir

The 'evir' package in R provides functions for extreme value theory, including exploratory data analysis and various statistical distributions. It contains datasets such as daily log returns on BMW share prices and large fire insurance claims in Denmark. The package is maintained by Bernhard Pfaff and is available on CRAN.

Uploaded by

roziyoussouf8
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Package ‘evir’

May 8, 2026
Version 1.7-4
Date 2018-03-19
Title Extreme Values in R
Depends stats
Description Functions for extreme value theory, which may be
divided into the following groups; exploratory data analysis,
block maxima, peaks over thresholds (univariate and bivariate),
point processes, gev/gpd distributions.
License GPL (>= 2)
Author Bernhard Pfaff [aut, cre],
Eric Zivot [ctb],
Alexander McNeil [aut] (S original (EVIS)),
Alec Stephenson [trl] (R port of EVIS)
Maintainer Bernhard Pfaff <bernhard@[Link]>
Repository CRAN
Repository/R-Forge/Project evir
Repository/R-Forge/Revision 13
Repository/R-Forge/DateTimeStamp 2018-03-19 20:00:59
Date/Publication 2018-03-20 12:00:27 UTC
NeedsCompilation no

Contents
bmw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
danish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
decluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
dgev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
dgpd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
emplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
exindex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
findthresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1
2 bmw

gev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
gpd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
gpd.q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
gpdbiv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
gumbel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
hill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
meplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
pot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
qplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
quant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
riskmeasures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
siemens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
[Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
spto87 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
tailplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Index 32

bmw Daily Log Returns on BMW Share Price

Description
These data are the daily log returns on BMW share price from Tuesday 2nd January 1973 until
Tuesday 23rd July 1996. The data are contained in a numeric vector. The dates of each observation
are contained in a times attribute, which is an object of class "POSIXct" (see DateTimeClasses).
Note that these data form an irregular time series because no trading takes place at the weekend.

Usage
data(bmw)

Format
A numeric vector containing 6146 observations, with a times attribute which is a POSIXct object
of the same length.
danish 3

danish Danish Fire Insurance Claims

Description
These data describe large fire insurance claims in Denmark from Thursday 3rd January 1980 un-
til Monday 31st December 1990. The data are contained in a numeric vector. The dates of
each observation are contained in a times attribute, which is an object of class "POSIXct" (see
DateTimeClasses). They were supplied by Mette Rytgaard of Copenhagen Re. Note that these
data form an irregular time series.

Usage
data(danish)

Format
A numeric vector containing 2167 observations, with a times attribute which is a POSIXct object
of the same length.

decluster Decluster Point Process

Description
Declusters clustered point process data so that Poisson assumption is more tenable over a high
threshold.

Usage
decluster(series, run = NA, picture = TRUE)

Arguments
series a numeric vector of threshold exceedances with a times attribute which should
be a numeric vector containing either the indices or the times/dates of each ex-
ceedance (if times/dates, the attribute should be an object of class "POSIXct" or
an object that can be converted to that class; see [Link])
run parameter to be used in the runs method; any two consecutive threshold ex-
ceedances separated by more than this number of observations/days are consid-
ered to belong to different clusters
picture whether or not a picture of declustering should be drawn

Value
The declustered object.
4 dgev

References
Embrechts, P., Klueppelberg, C., Mikosch, T. (1997). Modelling Extremal Events. Springer. Chap-
ter 8, 413–429.

See Also
pot, exindex, [Link]

Examples
# decluster the 200 exceedances of a particular threshold in
# the negative BMW data
data(bmw)
out <- pot(-bmw, ne = 200)
decluster(out$data, 30)

dgev Generalized Extreme Value Distribution

Description
Cumulative probability, quantiles, density and random generation from the generalized extreme
value distribution.

Usage
pgev(q, xi = 1, mu = 0, sigma = 1)
qgev(p, xi = 1, mu = 0, sigma = 1)
dgev(x, xi = 1, mu = 0, sigma = 1)
rgev(n, xi = 1, mu = 0, sigma = 1)

Arguments
q vector of quantiles
p vector of probabilities
x vector of values at which to evaluate density
n sample size
xi shape parameter
mu location parameter
sigma scale parameter

Value
Probability (pgev), quantile (qgev), density (dgev) or random sample (rgev) for the GEV distribu-
tion with shape xi.
dgpd 5

See Also

dgpd, gev

dgpd Generalized Pareto Distribution

Description

Cumulative probability, quantiles, density and random generation from the generalized Pareto dis-
tribution.

Usage

pgpd(q, xi, mu = 0, beta = 1)


qgpd(p, xi, mu = 0, beta = 1)
dgpd(x, xi, mu = 0, beta = 1)
rgpd(n, xi, mu = 0, beta = 1)

Arguments

q vector of quantiles.
p vector of probabilities.
x vector of values at which to evaluate density
n sample size
xi shape parameter.
mu location parameter.
beta scale parameter

Value

Probability (pgpd), quantile (qgpd), density (dgpd) or random sample (rgpd) for the GPD distribu-
tion with shape xi.

See Also

dgev, gpd
6 exindex

emplot Plot of Empirical Distribution Function

Description
Plots empirical distribution function of a sample.

Usage
emplot(data, alog = "x", labels = TRUE, ...)

Arguments
data data vector
alog whether axes are to be logged: "x" x-axis only; "y" y-axis only; "xy" both axes;
"" neither axis.
labels whether or not axes should be labelled
... other graphics parameters

Details
This is a simple explanatory function. A straight line on the double log scale indicates Pareto tail
behaviour.

See Also
qplot, meplot

Examples
## Not run: data(danish)
## Not run: emplot(danish)
# Danish fire insurance data show Pareto tail behaviour

exindex Estimate Extremal Index

Description
Plot estimates of extremal index using the blocks method.

Usage
exindex(data, block, start = 5, end = NA, reverse = FALSE,
[Link] = TRUE, labels = TRUE, ...)
exindex 7

Arguments

data data vector (raw values not block maxima).


block the block size. A numeric value is interpreted as the number of data values in
each successive block. All the data is used, so the last block may not contain
block observations. If the data has a times attribute containing (in an ob-
ject of class "POSIXct", or an object that can be converted to that class; see
[Link]) the times/dates of each observation, then block may instead take
the character values "month", "quarter", "semester" or "year".
start lowest value of K at which to plot a point; K is the number of blocks in which a
specified threshold is exceeded
end highest value of K at which to plot a point
reverse whether plot is to be by increasing threshold (TRUE) or increasing K value (FALSE)
[Link] whether or not plot should be automatically scaled; if not, xlim and ylim graph-
ical parameters may be entered
labels whether or not axes should be labelled
... other graphics parameters

Value

A table of results is returned invisibly.

References

Embrechts, P., Klueppelberg, C., Mikosch, T. (1997). Modelling Extremal Events. Springer. Chap-
ter 8, 413-429.

See Also

gev, hill, [Link]

Examples

## Not run: data(bmw)


## Not run: exindex(bmw, 100)
## Not run: exindex(-bmw, 100)
# calculate extremal index for the right and left tails of the BMW
# log returns
8 gev

findthresh Find Threshold

Description
Finds a threshold so that a given number of extremes lie above.

Usage
findthresh(data, ne)

Arguments
data data vector
ne vector giving number of extremes above the threshold

Details
When the data are tied a threshold is found so that at least the specified number of extremes lie
above.

Value
Vector of suitable thresholds.

See Also
hill, gpd, pot

Examples
# Find threshold giving (at least) fifty exceedances for Danish data
data(danish)
findthresh(danish, 50)

gev Fit Generalized Extreme Value Distribution

Description
Fits generalized extreme value distribution (GEV) to block maxima data.

Usage
gev(data, block = NA, ...)
gpd 9

Arguments
data data vector. Interpretation depends on value of block: if no block size is speci-
fied then data are interpreted as block maxima; if block size is set, then data are
interpreted as raw data and block maxima are calculated.
block the block size. A numeric value is interpreted as the number of data values in
each successive block. All the data is used, so the last block may not contain
block observations. If the data has a times attribute containing (in an ob-
ject of class "POSIXct", or an object that can be converted to that class; see
[Link]) the times/dates of each observation, then block may instead take
the character values "month", "quarter", "semester" or "year".
... arguments passed to optim

Value
An object of class gev describing the fit and including parameter estimates and standard errors.
Fitting is carried out using maximum likelihood.

See Also
[Link], gumbel, optim, [Link]

Examples
# Fit GEV to monthly maxima
data(bmw)
out <- gev(bmw, "month")
# Fit GEV to maxima of blocks of 100 observations
out <- gev(bmw, 100)
# Fit GEV to the data in [Link], the annual maximum water
# levels of the River Nidd, using the "BFGS" optimization method
data([Link])
out <- gev([Link], method = "BFGS", control = list(maxit = 500))

gpd Fit Generalized Pareto Model

Description
Returns an object of class "gpd" representing the fit of a generalized Pareto model to excesses over
a high threshold.

Usage
gpd(data, threshold = NA, nextremes = NA, method = c("ml", "pwm"),
information = c("observed", "expected"), ...)
10 gpd.q

Arguments
data data vector
threshold a threshold value (either this or nextremes must be given but not both)
nextremes the number of upper extremes to be used (either this or threshold must be given
but not both)
method whether parameters should be estimated by the maximum likelihood method
"ml" or the probability-weighted moments method "pwm"
information whether standard errors should be calculated with "observed" or "expected"
information. This only applies to the maximum likelihood method; for the
probability-weighted moments method "expected" information is used if pos-
sible
... arguments passed to optim

Details
The function uses the general purpose optimization function optim when method = "ml" is chosen.

Value
An object of class "gpd" describing the fit and including parameter estimates and standard errors.

References
Parameter and quantile estimation for the generalized Pareto distribution, JRM Hosking and JR
Wallis, Technometrics 29(3), pages 339-349, 1987.

See Also
[Link], shape, quant, optim

Examples
data(danish)
out <- gpd(danish, 10)
# Fits GPD to excess losses over 10 for the Danish
# fire insurance data

gpd.q Add Quantile Estimates to [Link]

Description
Calculates quantile estimates and confidence intervals for high quantiles above the threshold in a
GPD analysis, and adds a graphical representation to an existing plot.
[Link] 11

Usage
gpd.q(x, pp, [Link] = c("likelihood", "wald"), ci.p = 0.95,
[Link] = 50)

Arguments
x a list object returned by [Link] or tailplot
pp the desired probability for quantile estimate (e.g. 0.99 for the 99th percentile)
[Link] method for calculating a confidence interval: "likelihood" or "wald"
ci.p probability for confidence interval (must be less than 0.999)
[Link] number of times to evaluate profile likelihood

Details
The GPD approximation in the tail is used to estimate quantile. The "wald" method uses the
observed Fisher information matrix to calculate confidence interval. The "likelihood" method
reparametrizes the likelihood in terms of the unknown quantile and uses profile likelihood argu-
ments to construct a confidence interval.

See Also
gpd, [Link], [Link], tailplot

Examples
## Not run: data(danish)
## Not run: out <- gpd(danish, 10)
## Not run: tp <- tailplot(out)
## Not run: gpd.q(tp, 0.999)
# Estimates 99.9th percentile of Danish fire losses

[Link] Add Expected Shortfall Estimates to a GPD Plot

Description
Calculates expected shortfall (tail conditional expectation) estimates and confidence intervals for
high quantiles above the threshold in a GPD analysis, and adds a graphical representation to an
existing plot.

Usage
[Link](x, pp, ci.p = 0.95, [Link] = 50)
12 gpdbiv

Arguments

x a list object returned by [Link] or tailplot


pp the desired probability for expected shortfall estimate (e.g. 0.99 for the 99th
percentile)
ci.p probability for confidence interval (must be less than 0.999)
[Link] number of times to evaluate profile likelihood

Details

Expected shortfall is the expected size of the loss, given that a particular quantile of the loss dis-
tribution is exceeded. The GPD approximation in the tail is used to estimate expected shortfall.
The likelihood is reparametrised in terms of the unknown expected shortfall and profile likelihood
arguments are used to construct a confidence interval.

See Also

gpd, [Link], tailplot, gpd.q

Examples

## Not run: data(danish)


## Not run: out <- gpd(danish, 10)
## Not run: tp <- tailplot(out)
## Not run: gpd.q(tp, 0.999)
# Estimates 99.9th percentile of Danish fire losses
## Not run: [Link](tp, 0.999)
# Estimates associated expected shortfall for Danish fire losses

gpdbiv Implements Bivariate POT Method

Description

Returns an object of class "gpdbiv" representing the fit of a bivariate POT (peaks over thresholds)
model for joint excesses over thresholds.

Usage

gpdbiv(data1 = NA, data2 = NA, u1 = NA, u2 = NA, ne1 = NA, ne2 = NA,
global = FALSE, method = "BFGS", ...)
gpdbiv 13

Arguments

data1 first data vector


data2 second data vector
u1 threshold for data1 (either this or ne1 must be given but not both)
u2 threshold for data2 (either this or ne2 must be given but not both)
ne1 number of upper extremes to be used for data1 (either this or u1 must be given
but not both)
ne2 number of upper extremes to be used for data2 (either this or u2 must be given
but not both)
global should a global maximisation of the likelihood with respect to marginal and de-
pendence parameters be undertaken. The default alternative is a two-stage local
fit where first the marginal parameters are estimated and then the dependence
parameter. This is much faster than a global fit.
method the optimization method (see optim). The argument has been created (as distinct
from . . . ) in order to make the "BFGS" method the default, as the default used
by optim is not recommended for the one-dimensional optimizations that occur
when global = FALSE.
... other arguments passed to optim

Details

This function implements a model suggested by Richard Smith (see references below). The marginal
excess distributions are GPD distributions, as suggested by univariate EVT and implemented in gpd.
The dependence specification is known as the logistic or Gumbel dependence structure, but it would
be easy to program alternatives.

Value

An object of class "gpdbiv" representing the fit and including parameter estimates and standard
errors.

References

Multivariate Threshold Methods, Richard L. Smith, in Extreme Value Theory and Applications, ed.
J. Galambos, published by Kluwer, pages 225-248, 1994.
Markov Chain Models for Threshold Exceedances, R.L. Smith, J.A. Tawn, S.G. Coles, Biometrika
84, 249-268, 1997.

See Also

gpd, [Link], [Link]


14 gumbel

Examples
data(bmw) ; data(siemens)
out <- gpdbiv(-bmw, -siemens, ne1 = 100, ne2 = 100)
[Link](out, 0.05, 0.05)
## Not run: plot(out)

gumbel Fit Gumbel Distribution

Description

Fits gumbel distribution (GEV with xi = 0) to block maxima data.

Usage

gumbel(data, block = NA, ...)

Arguments

data data vector. Interpretation depends on value of block: if no block size is speci-
fied then data are interpreted as block maxima; if block size is set, then data are
interpreted as raw data and block maxima are calculated.
block the block size. A numeric value is interpreted as the number of data values in
each successive block. All the data is used, so the last block may not contain
block observations. If the data has a times attribute containing (in an ob-
ject of class "POSIXct", or an object that can be converted to that class; see
[Link]) the times/dates of each observation, then block may instead take
the character values "month", "quarter", "semester" or "year".
... arguments passed to optim

Details

This function is primarily intended for comparison with GEV for assessing the need for a heavy-
tailed Frechet (or short-tailed Weibull) to model block maxima.

Value

An object of class "gev" describing the fit and including parameter estimates and standard errors.
Fitting is carried out using maximum likelihood.

See Also

[Link], gev, optim, [Link]


hill 15

Examples
# Fit Gumbel to maxima of blocks of 100 observations
data(bmw)
out <- gumbel(bmw, 100)
# Fit Gumbel to the data in [Link], the annual maximum water
# levels of the River Nidd, using the "BFGS" optimization method
data([Link])
out <- gumbel([Link], method = "BFGS", control = list(maxit = 500))

hill Create Hill Plot

Description
Plot the Hill estimate of the tail index of heavy-tailed data, or of an associated quantile estimate.

Usage
hill(data, option = c("alpha","xi","quantile"), start = 15,
end = NA, reverse = FALSE, p = NA, ci = 0.95,
[Link] = TRUE, labels = TRUE, ...)

Arguments
data data vector
option whether "alpha", "xi" (1/alpha) or "quantile" (a quantile estimate) should
be plotted
start lowest number of order statistics at which to plot a point
end highest number of order statistics at which to plot a point
reverse whether plot is to be by increasing threshold (TRUE) or increasing number of
order statistics (FALSE)
p probability required when option "quantile" is chosen
ci probability for asymptotic confidence band; for no confidence band set ci to
zero
[Link] whether or not plot should be automatically scaled; if not, xlim and ylim graph-
ical parameters may be entered
labels whether or not axes should be labelled
... other graphics parameters

Details
This plot is usually calculated from the alpha perspective. For a generalized Pareto analysis of
heavy-tailed data using the gpd function, it helps to plot the Hill estimates for xi.
16 [Link]

See Also
shape, quant

Examples
## Not run: data(danish)
## Not run: hill(danish)
# Hill plot of heavy-tailed Danish fire insurance data
## Not run: hill(danish, option = "quantile", end = 500, p = 0.999)
# Hill plot of estimated 0.999 quantile of Danish fire insurance data

[Link] Interpret Results of Bivariate GPD Fit

Description
Interprets the results of a bivariate GPD model fitted using the bivariate POT method.

Usage
[Link](out, x, y)

Arguments
out a gpdbiv object
x a scalar value greater than first threshold
y a scalar value greater than second threshold

Details
First marginal probabilities of exceeding the points x and y are calculated, and then joint and con-
ditional probabilities.

Value
A vector of probabilities is invisibly returned, in printed order.

Side Effects
A simple interpretation of the fit in terms of exceedance probabilities for the point (x,y) is printed.

See Also
gpdbiv, [Link]
meplot 17

Examples
data(bmw) ; data(siemens)
out <- gpdbiv(-bmw, -siemens, ne1 = 100, ne2 = 100)
[Link](out, 0.05, 0.05)
# probabilities of 5% falls in BMW and Siemens stock prices

meplot Sample Mean Excess Plot

Description

Plots sample mean excesses over increasing thresholds.

Usage

meplot(data, omit = 3, labels = TRUE, ...)

Arguments

data data vector


omit number of upper plotting points to be omitted
labels whether or not axes are to be labelled
... other graphics parameters

Details

An upward trend in plot shows heavy-tailed behaviour. In particular, a straight line with positive
gradient above some threshold is a sign of Pareto behaviour in tail. A downward trend shows thin-
tailed behaviour whereas a line with zero gradient shows an exponential tail. Because upper plotting
points are the average of a handful of extreme excesses, these may be omitted for a prettier plot.

See Also

gpd, qplot

Examples
## Not run: data(danish)
## Not run: meplot(danish)
# Sample mean excess plot of heavy-tailed Danish fire insurance data
18 [Link]

[Link] The River Nidd Data

Description
These data represent annual maximal levels of the River Nidd in Yorkshire. These data are suitable
for analysis with gev.

Usage
data([Link])

Format
A numeric vector containing 35 observations.

[Link] The River Nidd Data

Description
These data represent high river levels of the River Nidd in Yorkshire above a threshold value of 65.
These data are suitable for analysis with gpd.

Usage
data([Link])

Format
A numeric vector containing 154 observations.

[Link] Plot Fitted GEV Model

Description
The plot method [Link] provides two different residual plots for assessing fitted GEV model. The
user selects the plot type from a menu. See the examples below.

Usage
## S3 method for class 'gev'
plot(x, ...)
[Link] 19

Arguments
x a gev object
... other graphics parameters

Details
Data are converted to unit exponentially distributed residuals under null hypothesis that GEV fits.
Two diagnostics for iid exponential data are offered.

See Also
gev, qplot

Examples
data(bmw)
out <- gev(bmw, 100)
## Not run: plot(out)

## Not run: Make a plot selection (or 0 to exit):


## Not run: 1: plot: Scatterplot of Residuals
## Not run: 2: plot: QQplot of Residuals

[Link] Plot Fitted GPD Model

Description
The plot method [Link] provides four different plots for assessing fitted GPD model. The user
selects the plot type from a menu. See the examples below.

Usage
## S3 method for class 'gpd'
plot(x, optlog = NA, extend = 1.5, labels = TRUE, ...)

Arguments
x a gpd object
optlog optional argument for plots 1 and 2 giving a particular choice of logarithmic
axes: "x" x-axis only; "y" y-axis only; "xy" both axes; "" neither axis.
extend optional argument for plots 1 and 2 expressing how far x-axis should extend as
a multiple of the largest data value. This argument must take values greater than
1 and is useful for showing estimated quantiles beyond data.
labels optional argument for plots 1 and 2 specifying whether or not axes should be
labelled
... other graphics parameters
20 [Link]

Value
If plot 1 or 2 is selected as the final plot, a list object containing details of the plot is returned
invisibly. This object should be used as the first argument of gpd.q or [Link] to add quantile
estimates or expected shortfall estimates to the plot.

See Also
gpd, quant, shape

Examples
data(danish)
out <- gpd(danish, 10)
## Not run: plot(out)

## Not run: Make a plot selection (or 0 to exit):


## Not run: 1: plot: Excess Distribution
## Not run: 2: plot: Tail of Underlying Distribution
## Not run: 3: plot: Scatterplot of Residuals
## Not run: 4: plot: QQplot of Residuals

[Link] Plot Fitted Bivariate GPD Model

Description
Provides a number of plots summarising a bivariate GPD model fitted using the bivariate POT
method. See the examples below.

Usage
## S3 method for class 'gpdbiv'
plot(x, extend = 1.1, [Link] = 15, ...)

Arguments
x a gpdbiv object
extend optional argument expressing how far x-axis should extend as a multiple of the
largest data value.
[Link] number of contours in bivariate contour plots
... other graphics parameters

Details
Option 1 plots the threshold exceedance data; option 2 plots contours of the fitted bivariate distribu-
tion function in the joint upper tail (above both thresholds); option 3 plots corresponding contours
of the fitted joint survival function; plots 4 and 5 show the fitted tails of the marginal distributions.
[Link] 21

See Also
gpd, gpdbiv, tailplot, [Link], [Link]

Examples
data(bmw) ; data(siemens)
out <- gpdbiv(-bmw, -siemens, ne1 = 100, ne2 = 100)
## Not run: plot(out)

## Not run: Make a plot selection (or 0 to exit):


## Not run: 1: plot: Exceedance data
## Not run: 2: plot: Contours of Bivariate Distribution Function
## Not run: 3: plot: Contours of Bivariate Survival Function
## Not run: 4: plot: Tail of Marginal 1
## Not run: 5: plot: Tail of Marginal 2

[Link] Plot Fitted POT Model

Description
The plot method [Link] provides seven different plots for assessing fitted POT model. The user
selects the plot type from a menu. See the examples below.

Usage
## S3 method for class 'potd'
plot(x, ...)

Arguments
x an object returned by the function pot
... other graphics parameters

Details
Plot 1 displays the exceedance process of the chosen threshold. Plots 2-4 assess the Poisson nature
of the exceedance process by looking at the scaled gaps between exceedances, which should be
iid unit exponentially distributed. Plots 5-6 assess the GPD nature of the excesses by looking at
suitably defined residuals, which should again be iid unit exponentially distributed. Option 8 allows
the user to call GPD plotting functions.

Value
If plot 1 or 2 from the GPD plots is selected as the final plot (i.e. option 8 is selected, followed by
option 1 or 2), a list object containing details of the plot is returned invisibly. This object should
be used as the first argument of gpd.q or [Link] to add quantile estimates or expected shortfall
estimates to the plot.
22 pot

See Also
gpd, pot, [Link]

Examples
data(danish)
out <- pot(danish,10)
## Not run: plot(out)

## Not run: Make a plot selection (or 0 to exit):


## Not run: 1: plot: Point Process of Exceedances
## Not run: 2: plot: Scatterplot of Gaps
## Not run: 3: plot: Qplot of Gaps
## Not run: 4: plot: ACF of Gaps
## Not run: 5: plot: Scatterplot of Residuals
## Not run: 6: plot: Qplot of Residuals
## Not run: 7: plot: ACF of Residuals
## Not run: 8: plot: Go to GPD Plots

pot Peaks Over Thresholds Model

Description
Fits a Poisson point process to the data, an approach sometimes known as peaks over thresholds
(POT), and returns an object of class "potd".

Usage
pot(data, threshold = NA, nextremes = NA, run = NA, picture = TRUE,
...)

Arguments
data numeric vector of data, which may have a times attribute containing (in an
object of class "POSIXct", or an object that can be converted to that class; see
[Link]) the times/dates of each observation. If no times attribute exists,
the data are assumed to be equally spaced.
threshold a threshold value (either this or nextremes must be given but not both)
nextremes the number of upper extremes to be used (either this or threshold must be given
but not both)
run if the data are to be declustered the run length parameter for the runs method
(see decluster) should be entered here
picture whether or not a picture should be drawn if declustering is performed
... arguments passed to optim
qplot 23

Details
Uses optim for point process likelihood maximization.

Value
An object of class "potd" describing the fit and including parameter estimates and standard errors.

See Also
gpd, [Link], [Link], decluster, optim, [Link]

Examples
data(danish)
out <- pot(danish, 10)
# Fits POT model to Danish fire insurance losses

qplot Exploratory QQplot for Extreme Value Analysis

Description
Creates a QQplot for threshold data against the exponential distribution or the generalized Pareto
distribution.

Usage
qplot(data, xi = 0, trim = NA, threshold = NA, line = TRUE,
labels = TRUE, ...)

Arguments
data data vector
xi the xi value of a generalized Pareto distribution
trim value at which data are to be right-truncated
threshold value at which data are to be left-truncated
line whether or not a straight line is to be added
labels whether or not the axes are to be labelled
... other graphics parameters

Details
If xi is zero the reference distribution is the exponential; if xi is non-zero the reference distribution
is the generalized Pareto with that value of xi. In the case of the exponential, the plot is interpreted
as follows. Concave departures from a straight line are a sign of heavy-tailed behaviour. Convex
departures show thin-tailed behaviour.
24 quant

See Also
gpd, meplot

Examples
## Not run: data(danish)
## Not run: qplot(danish)
# QQplot of heavy-tailed Danish fire insurance data

quant Plot of GPD Tail Estimate of a High Quantile

Description
Creates a plot showing how the estimate of a high quantile in the tail of a dataset based on the GPD
approximation varies with threshold or number of extremes.

Usage
quant(data, p = 0.99, models = 30, start = 15, end = 500, reverse =
TRUE, ci = 0.95, [Link] = TRUE, labels = TRUE, ...)

Arguments
data numeric vector of data
p desired probability for quantile estimate (e.g. 0.99 gives 99th percentile)
models number of consecutive gpd models to be fitted
start lowest number of exceedances to be considered
end maximum number of exceedances to be considered
reverse should plot be by increasing threshold (TRUE) or number of extremes (FALSE)
ci probability for asymptotic confidence band; for no confidence band set to zero
[Link] whether or not plot should be automatically scaled; if not, xlim and ylim graph-
ical parameters may be entered
labels whether or not axes should be labelled
... other graphics parameters

Details
For every model gpd is called. Evaluation may be slow. Confidence intervals by the Wald method
(which is fastest).

Value
A table of results is returned invisibly.
records 25

See Also
gpd, [Link], gpd.q, shape

Examples
## Not run: data(danish)
## Not run: quant(danish, 0.999)
# Estimates of the 99.9th percentile of the Danish losses using
# the GPD model with various thresholds

records Calculate Record Development

Description
Creates a data frame showing the development of records in a dataset and calculating the expected
behaviour for iid data.

Usage
records(data, [Link] = TRUE, [Link] = 0.95, ...)

Arguments
data data vector
[Link] whether a plot of record development should be created
[Link] confidence level for record development plot
... graphics parameters

Details
Records are counted and the observations at which they occur recorded. This is compared with the
expected behaviour for iid data.

Value
A data frame.

Examples
## Not run: data(danish)
## Not run: records(danish)
# Record fire insurance losses in Denmark
26 riskmeasures

riskmeasures Calculates Quantiles and Expected Shortfalls

Description

Makes a rapid calculation of point estimates of prescribed quantiles and expected shortfalls using
the output of the function gpd.

Usage

riskmeasures(x, p)

Arguments

x results of a gpd fit


p a vector of probability levels

Details

This function simply calculates point estimates and (at present) makes no attempt to calculate con-
fidence intervals for the risk measures. If confidence levels are required use gpd.q and [Link]
which interact with graphs of the tail of a loss distribution and are much slower.

Value

A matrix with three columns: probability level, quantile estimate, shortfall estimate.

See Also

gpd, tailplot, gpd.q, [Link]

Examples

data(danish)
out <- gpd(danish, 10)
riskmeasures(out, c(0.999, 0.9999))
# gives estimates of 0.999 and 0.9999 quantiles of Danish loss
# distribution as well as the associated expected shortfall estimates
[Link] 27

[Link] Calculate Return Levels Based on GEV Fit

Description
Calculates the k-block return level and 95% confidence interval based on a GEV model for block
maxima, where k is specified by the user. The k-block return level is that level exceeded once every
k blocks, on average.

Usage
[Link](out, [Link] = 20, add = FALSE, ...)

Arguments
out an object returned by the function gev
[Link] specifies the particular return level to be estimated; default set arbitrarily to 20
add whether the return level should be added graphically to a time series plot; if
FALSE a graph of the profile likelihood curve showing the return level and its
confidence interval is produced
... other graphics parameters

Details
The GEV likelihood is reparameterized in terms of the unknown return level and profile likelihood
arguments are used to construct a confidence interval.

Value
Vector containing lower 95% bound of confidence interval, estimated return level and upper 95%
bound.

See Also
gev, [Link]

Examples
data(bmw)
out <- gev(bmw, "month")
# Fit GEV to monthly maxima of daily returns on BMW share price
## Not run: [Link](out, 40)
# Calculate the 40 month return level
28 shape

shape Plot for GPD Shape Parameter

Description
Creates a plot showing how the estimate of shape varies with threshold or number of extremes.

Usage
shape(data, models = 30, start = 15, end = 500, reverse = TRUE,
ci = 0.95, [Link] = TRUE, labels = TRUE, ...)

Arguments
data numeric vector of data
models number of consecutive gpd models to be fitted
start lowest number of exceedances to be considered
end maximum number of exceedances to be considered
reverse should plot be by increasing threshold (TRUE) or number of extremes (FALSE)
ci probability for asymptotic confidence band; for no confidence band set to zero
[Link] whether or not plot should be automatically scaled; if not, xlim and ylim graph-
ical parameters may be entered
labels whether or not axes should be labelled
... other graphics parameters

Details
For every model gpd is called. Evaluation may be slow.

Value
A table of results is returned invisibly.

See Also
gpd, [Link], hill

Examples
## Not run: data(danish)
## Not run: shape(danish)
# Shape plot of heavy-tailed Danish fire insurance data
siemens 29

siemens Daily Log Returns on Siemens Share Price

Description

These data are the daily log returns on Siemens share price from Tuesday 2nd January 1973 until
Tuesday 23rd July 1996. The data are contained in a numeric vector. The dates of each observation
are contained in a times attribute, which is an object of class "POSIXct" (see DateTimeClasses).
Note that these data form an irregular time series because no trading takes place at the weekend.

Usage

data(siemens)

Format

A numeric vector containing 6146 observations, with a times attribute which is a POSIXct object
of the same length.

[Link] SP Data to June 1993

Description

The daily closing values of the S&P index from Monday 4th January 1960 until Friday 11th June
1993. The data are contained in a numeric vector. The dates of each observation are contained in a
times attribute, which is an object of class "POSIXct" (see DateTimeClasses).

Usage

data([Link])

Format

A numeric vector containing 8415 observations, with a times attribute which is a POSIXct object
of the same length.
30 tailplot

spto87 SP Return Data to October 1987

Description
The daily log returns on the S&P index value from Tuesday 5th January 1960 until Friday 16
October 1987. The data are contained in a numeric vector. The dates of each observation are
contained in a times attribute, which is an object of class "POSIXct" (see DateTimeClasses).

Usage
data(spto87)

Format
A numeric vector containing 6985 observations, with a times attribute which is a POSIXct object
of the same length.

tailplot Plot Tail Estimate From GPD Model

Description
Interacts with the output of gpd to produce a plot of the tail of the underlying distribution of the
data. This is one of the options of [Link], but tailplot enables the user to bypass the menu of the
former.

Usage
tailplot(x, optlog = NA, extend = 1.5, labels = TRUE, ...)

Arguments
x a gpd object
optlog optional argument giving a particular choice of logarithmic axes: "x" x-axis
only; "y" y-axis only; "xy" both axes; "" neither axis.
extend optional argument expressing how far x-axis should extend as a multiple of the
largest data value. This argument must take values greater than 1 and is useful
for showing estimated quantiles beyond data.
labels optional argument specifying whether or not axes should be labelled
... other graphics parameters
tailplot 31

Value
A list object containing details of the plot is returned invisibly. This object should be used as the
first argument of gpd.q or [Link] to add quantile estimates or expected shortfall estimates to
the plot.

See Also
gpd, [Link], shape, quant

Examples
data(danish)
out <- gpd(danish, 10)
## Not run: tailplot(out)
Index

∗ datasets gumbel, 14
bmw, 2 pot, 22
danish, 3
[Link], 18 [Link], 3, 4, 7, 9, 14, 22, 23
[Link], 18
bmw, 2
siemens, 29
[Link], 29 danish, 3
spto87, 30 DateTimeClasses, 2, 3, 29, 30
∗ distribution decluster, 3, 22, 23
dgev, 4 dgev, 4, 5
dgpd, 5 dgpd, 5, 5
∗ hplot
emplot, 6 emplot, 6
exindex, 6 exindex, 4, 6
hill, 15
meplot, 17 findthresh, 8
[Link], 18
gev, 5, 7, 8, 14, 19, 27
[Link], 19
gpd, 5, 8, 9, 11–13, 17, 20–26, 28, 31
[Link], 20
gpd.q, 10, 12, 25, 26
[Link], 21
[Link], 11, 11, 26
qplot, 23
gpdbiv, 12, 16, 21
quant, 24
gumbel, 9, 14
records, 25
shape, 28 hill, 7, 8, 15, 28
tailplot, 30
∗ htest [Link], 13, 16, 21
[Link], 16
riskmeasures, 26 meplot, 6, 17, 24
[Link], 27
[Link], 18
∗ iplot
[Link], 18
gpd.q, 10
[Link], 11 optim, 9, 10, 14, 23
∗ manip
decluster, 3 pgev (dgev), 4
findthresh, 8 pgpd (dgpd), 5
∗ models [Link], 9, 14, 18, 27
gev, 8 [Link], 10–12, 19, 21–23, 25, 28, 31
gpd, 9 [Link], 13, 16, 20
gpdbiv, 12 [Link], 21, 23

32
INDEX 33

pot, 4, 8, 22, 22

qgev (dgev), 4
qgpd (dgpd), 5
qplot, 6, 17, 19, 23
quant, 10, 16, 20, 24, 31

records, 25
rgev (dgev), 4
rgpd (dgpd), 5
riskmeasures, 26
[Link], 27

shape, 10, 16, 20, 25, 28, 31


siemens, 29
[Link], 29
spto87, 30

tailplot, 11, 12, 21, 26, 30

You might also like