clusters {evd} | R Documentation |
Identify Clusters of Exceedences
Description
Identify clusters of exceedences.
Usage
clusters(data, u, r = 1, ulow = -Inf, rlow = 1, cmax = FALSE, keep.names
= TRUE, plot = FALSE, xdata = seq(along = data), lvals = TRUE, lty =
1, lwd = 1, pch = par("pch"), col = if(n > 250) NULL else "grey",
xlab = "Index", ylab = "Data", ...)
Arguments
data |
A numeric vector, which may contain missing values. |
u |
A single value giving the threshold, unless a time varying
threshold is used, in which case |
r |
A postive integer denoting the clustering interval length. By default the interval length is one. |
ulow |
A single value giving the lower threshold, unless a time
varying lower threshold is used, in which case |
rlow |
A postive integer denoting the lower clustering interval length. By default the interval length is one. |
cmax |
Logical; if |
keep.names |
Logical; if |
plot |
Logical; if |
xdata |
A numeric vector with the same length as |
lvals |
Logical; should the values below the threshold and the line depicting the lower threshold be plotted? |
lty , lwd |
Line type and width for the lines depicting the threshold and the lower threshold. |
pch |
Plotting character. |
col |
Strips of colour |
xlab , ylab |
Labels for the x and y axis. |
... |
Other graphics parameters. |
Details
The clusters of exceedences are identified as follows.
The first exceedence of the threshold initiates the first cluster.
The first cluster then remains active until either r
consecutive values fall below (or are equal to) the threshold,
or until rlow
consecutive values fall below (or are equal
to) the lower threshold.
The next exceedence of the threshold (if it exists) then initiates
the second cluster, and so on.
Missing values are allowed, in which case they are treated as
falling below (or equal to) the threshold, but falling above the
lower threshold.
Value
If cmax
is FALSE
(the default), a list with one
component for each identified cluster.
If cmax
is TRUE
, a numeric vector containing the
cluster maxima.
In any case, the returned object has an attribute acs
,
giving the average cluster size (where the cluster size is
defined as the number of exceedences within a cluster), which
will be NaN
if there are no values above the threshold
(and hence no clusters).
If plot
is TRUE
, the list of clusters, or vector
of cluster maxima, is returned invisibly.
See Also
Examples
clusters(portpirie, 4.2, 3)
clusters(portpirie, 4.2, 3, cmax = TRUE)
clusters(portpirie, 4.2, 3, 3.8, plot = TRUE)
clusters(portpirie, 4.2, 3, 3.8, plot = TRUE, lvals = FALSE)
tvu <- c(rep(4.2, 20), rep(4.1, 25), rep(4.2, 20))
clusters(portpirie, tvu, 3, plot = TRUE)