Learn R Programming

extRemes (version 2.0-9)

blockmaxxer: Find Block Maxima

Description

Find the block maximum of a data set.

Usage

blockmaxxer(x, ...)

# S3 method for data.frame blockmaxxer(x, ..., which = 1, blocks = NULL, blen = NULL, span = NULL)

# S3 method for fevd blockmaxxer(x, ...)

# S3 method for matrix blockmaxxer(x, ..., which = 1, blocks = NULL, blen = NULL, span = NULL)

# S3 method for vector blockmaxxer(x, ..., blocks = NULL, blen = NULL, span = NULL)

Arguments

x

An object of class “fevd” where the fit is for a PP model, a numeric vector, matrix or data frame.

optional arguments to max.

which

number or name of a column indicating for which column to take the block maxima. Note, this does not take componentwise maxima (as in the multivariate setting). Instead, it takes the maxima for a single column and returns a vector, data frame or matrix of the block maxima for that column along with the entire row where that maxima occurred.

blocks

numeric (integer or factor) vector indicating the blocks over which to take the maxima. Must be non-NULL if blen and span are NULL.

blen

(optional) may be used instead of the blocks argument, and span must be non-NULL. This determines the length of the blocks to be created. Note, the last block may be smaller or larger than blen. Ignored if blocks is not NULL.

span

(optional) must be specified if blen is non-NULL and blocks is NULL. This is the number of blocks over which to take the maxima, and the returned value will be either a vector of length equal to span or a matrix or data frame with span rows.

Value

vector of length equal to the number of blocks (vector method) or a matrix or data frame with number of rows equal to the number of blocks (matrix and data frame methods).

The fevd method is for finding the block maxima of the data passed to a PP model fit and the blocks are determined by the npy and span components of the fitted object. If the fevd object is not a PP model, the function will error out. This is useful for utilizing the PP model in the GEV with approximate annual maxima. Any covariate values that occur contiguous with the maxima are returned as well.

The aggregate function is used with max in order to take the maxima from each block.

See Also

fevd, max, aggregate

Examples

Run this code
# NOT RUN {
data(Fort)

bmFort <- blockmaxxer(Fort, blocks = Fort$year, which="Prec")

plot(Fort$year, Fort$Prec, xlab = "Year", ylab = "Precipitation (inches)",
    cex = 1.25, cex.lab = 1.25,
    col = "darkblue", bg = "lightblue", pch = 21)

points(bmFort$year, bmFort$Prec, col="darkred", cex=1.5)

# }

Run the code above in your browser using DataLab