Skip to contents

Extracts block maxima from a univariate numeric vector or matrix using disjoint, sliding, or circular (k-dependent) block schemes.

Usage

blockmax(xx, block_size, type = "sb", k = 2)

Arguments

xx

A numeric vector or matrix. For matrix input, each row is treated as a separate univariate series.

block_size

Positive integer. Size of each block for maxima extraction.

type

Character. Type of block maxima to compute. One of: "db" (disjoint blocks), "sb" (sliding blocks), or "cb" (circular blocks with k offsets).

k

Integer (only used if type = "cb"). Blocking parameter which controls the number of blocks contained in a block of blocks. Must be an integer between 1 and floor(length(xx) / block_size).

Value

A numeric vector (if xx is a vector) or a matrix (if xx is a matrix). Each entry contains block maxima computed according to the selected method.

Examples

if (requireNamespace("maxbootR", quietly = TRUE)) {
  set.seed(42)
  x <- rnorm(100)

  # Disjoint blocks of size 10
  bm_db <- blockmax(xx = x, block_size = 10, type = "db")

  # Sliding blocks of size 10
  bm_sb <- blockmax(xx = x, block_size = 10, type = "sb")

  # Circular blocks of size 10 with blocking parameter k = 2
  bm_cb <- blockmax(xx = x, block_size = 10, type = "cb", k = 2)
}