Calculate corresponding weight to return period

calculate.weight(x, ...)

Arguments

x

vector or array of period.

...

other parameters

Value

vector or array of corresponding weight.

Author

Frédéric Grelot, frederic.grelot.1994_cran@m4x.org

Examples

 
x1 = c(4, 10, 30, 100, 1000)
names(x1) = c("min", "small", "medium", "large", "max")
calculate.weight(x1)
#>        min      small     medium      large        max 
#> 0.07500000 0.10833333 0.04500000 0.01616667 0.00450000 
x2 = c(10, 15, 50, 100, 1500)
y1 = cbind(x1, x2)
calculate.weight(y1, 2)
#>                x1          x2
#> min    0.07500000 0.016666667
#> small  0.10833333 0.040000000
#> medium 0.04500000 0.028333333
#> large  0.01616667 0.009666667
#> max    0.00450000 0.004666667
y2 = y1 * rep(2:3, each = 5)
if (FALSE) z = abind::abind(y1, y2, along = 3, make.names = TRUE)
z = array(cbind(y1, y2), dim = c(dim(y1), 2), dimnames = c(dimnames(y1), list(c("y1", "y2"))))
calculate.weight(z, 2:3)
#> , , y1
#> 
#>                x1          x2
#> min    0.07500000 0.016666667
#> small  0.10833333 0.040000000
#> medium 0.04500000 0.028333333
#> large  0.01616667 0.009666667
#> max    0.00450000 0.004666667
#> 
#> , , y2
#> 
#>                 x1          x2
#> min    0.037500000 0.005555556
#> small  0.054166667 0.013333333
#> medium 0.022500000 0.009444444
#> large  0.008083333 0.003222222
#> max    0.002250000 0.001555556
#>