Learn R Programming

extRemes (version 1.65)

boot.matrix: Boot Matrices.

Description

Set up matrices for bootstrapping sequences of extreme values.

Usage

boot.matrix(x, y)

Arguments

x
Output from decluster.runs or decluster.intervals.
y
Vector of observations.

Value

  • A list containing two (unamed) matrices, each with columns corresponding to clusters identified in 'x.'
  • comp1inter-exceedance times
  • comp2Data values in 'y' corresponding to the exceedances in each cluster.

Details

This function merely formats the information needed by boot.sequence to improve efficiency.

See Also

boot.sequence, decluster.intervals, decluster.runs

Examples

Run this code
# Simulate 1000 uniform random variables.
x <- runif(1000)

# Perform runs declustering with run length = 1 and 90th percentile as threshold.
u <- quantile(x, 0.9)
z <- x > u
dec <- decluster.runs(z, 1)

# Make sure estimated run length is not zero before doing the rest.
if( dec[["par"]] != 0) {
   # Set up the matrices for bootstrapping.
   mat <- boot.matrix(dec, x)
   # Bootstrap with 500 iterations.
   eib <- numeric(500)
   for( i in 1:500) {
   	set.seed(i)
   	zb <- boot.sequence(mat[[1]],mat[[2]],u) > u
   	eib[i] <- exi.intervals(zb)
   	} # end of for 'i' loop.
   # Obtain bootstrapped 95th percentile confidence intervals.
   conf.int <- quantile( eib, c((1-0.95)/2,(1+0.95)/2))
} # end of if run length estimate not zero stmt.

Run the code above in your browser using DataLab