regionalize: Calculation of regionalized TL-moments

Description Usage Arguments Value Examples

View source: R/regionalize.R

Description

regionalize takes the result of TLMoments and calculates a weighted mean of TL-moments and TL-moment ratios.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
regionalize(x, ...)

## S3 method for class 'numeric'
regionalize(x, ...)

## S3 method for class 'matrix'
regionalize(x, w = attr(x, "source")$n, reg.lambdas = TRUE, ...)

## S3 method for class 'data.frame'
regionalize(x, w = attr(x, "source")$n, reg.lambdas = TRUE, ...)

## S3 method for class 'list'
regionalize(x, w = attr(x, "source")$n, reg.lambdas = TRUE, ...)

Arguments

x

object returned by TLMoments.

...

additional arguments, not used at the moment.

w

numeric vector giving the weights. Default: Sample lengths of corresponding data. Internally scaled so that it adds up to 1.

reg.lambdas

logical, if TRUE (default) regionalization is based upon TL-moments. If false it's based on TL-moment-ratios.

Value

list of two dimensions: lambdas/ratios are numeric vectors consisting of the regionalized TL-moments/TL-moment-ratios. The list has the class TLMoments. The object contains the following attributes:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
xmat <- matrix(rgev(100), nc = 4)
xvec <- xmat[, 3]
xlist <- lapply(1L:ncol(xmat), function(i) xmat[, i])
xdat <- data.frame(
 station = rep(letters[1:2], each = 50),
 season = rep(c("S", "W"), 50),
 hq = as.vector(xmat)
)

regionalize(TLMoments(xmat))
regionalize(TLMoments(xlist))
regionalize(TLMoments(xdat, hq ~ station))
# For numeric vector TLMoments, nothing happens:
regionalize(TLMoments(xvec))

tlm <- TLMoments(xmat)
regionalize(tlm)
regionalize(tlm, reg.lambdas = FALSE)

parameters(regionalize(tlm), "gev")
parameters(regionalize(tlm, reg.lambdas = FALSE), "gev")

quantiles(parameters(regionalize(tlm), "gev"), c(.99, .999))
quantiles(parameters(regionalize(tlm, reg.lambdas = FALSE), "gev"), c(.99, .999))


# With magrittr
library(magrittr)
matrix(rgev(200, shape = .3), nc = 5) %>%
 TLMoments(rightrim = 1) %>%
 regionalize %>%
 parameters("gev") %>%
 quantiles(c(.99, .999))

TLMoments documentation built on Dec. 4, 2019, 5:06 p.m.