Compute Clusters
clusters3.Rd
Compute clusters on the basis of a three-day period to separate clusters.
Arguments
- Date
A
Date
object.- y
A numeric vector representing a daily time series. Must have the same length as
Date
.- u
The threshold (vector). If
u
has length one, it will be recycled to reach the length ofy
andDate
.
Details
The cluster are sequences of successive dates such that: (1) any
exceedance falls in a cluster, (2) If two exceedances are
separated by three consecutive dates of non-exceedance, then they
are in different clusters. A NA
value is assumed to be a
non-exceedance.
Caution
A quite unreliable function, which will not work when there are exceedances at the ends. There exists much better function that can be used for declustering.
Examples
data(Fort)
Fort <- within(subset(Fort, year == 1999), {
Prec <- 2.54 * Prec;
Date <- as.Date(sprintf("%4d-%02d-%02d", year, month, day));
})
u0 <- quantile(Fort$Prec, prob = 0.97)
cl <- clusters3(Date = Fort$Date, y = Fort$Prec, u = u0)
plot(Prec ~ Date, data = Fort, type = "h", lwd = 2)
abline(h = u0, col = "SpringGreen3")
abline(v = cl$DateClust , col = "orangered")