Skip to contents

Compute the quantiles for stationary and nonstationary probability models.

For NS-FFA: To compute the quantiles for a nonstationary probability model, specify a time slice (ns_slice) and the nonstationary model structure (ns_structure).

Usage

utils_quantiles(p, distribution, params, ns_slice = 0, ns_structure = NULL)

Arguments

p

Numeric vector of probabilities between 0 and 1 with no missing values.

distribution

A three-character code indicating the distribution family. Must be "GUM", "NOR", "LNO", "GEV", "GLO", "GNO", "PE3", "LP3", or "WEI".

params

Numeric vector of distribution parameters, in the order (location, scale, shape). The length must be between 2 and 5, depending on the specified distribution and structure.

ns_slice

For NS-FFA only: Numeric scalar specifying the year at which to evaluate the quantiles of a nonstationary probability distribution. ns_slice does not have to be an element of the ns_years argument.

ns_structure

For NS-FFA only: Named list indicating which distribution parameters are modeled as nonstationary. Must contain two logical scalars:

  • location: If TRUE, the location parameter has a linear temporal trend.

  • scale: If TRUE, the scale parameter has a linear temporal trend.

Value

A numeric vector of quantiles with the same length as p.

Examples

p <- runif(n = 100)
params <- c(1, 1, 1)
utils_quantiles(p, "GEV", params)
#>   [1]   0.7449720   0.8006997   6.4605130   4.2354795   1.7069833   3.5726220
#>   [7]   0.7457033   4.4277932  13.9344347   1.0814305   0.8106945   1.8309980
#>  [13]  45.1187015   1.2136530   2.4485925   0.1823871  44.6464904  42.0391697
#>  [19]  40.0788151   0.7526790   0.9474955   0.6083237   0.7199473   0.9669532
#>  [25]   7.7998405   2.4265620   0.2261922   0.3723459  21.6732308 395.9278391
#>  [31]   1.9716244   3.6538059   4.9917506   0.5964725   1.9662502   0.5232789
#>  [37]   8.7803652   7.7422978   1.0784973   2.3520442  52.2756147   0.4447122
#>  [43]   1.7195182   3.6610685   8.8129367   0.4661800   0.4225514   0.4239579
#>  [49]   1.0327364   0.3045034   1.8240031   2.3203218   2.0867131   1.8761336
#>  [55]   9.5386837   1.7270419   0.5286169   0.1986658   4.6216791   2.3066335
#>  [61]   3.1784872   3.4942847  11.6457782   1.9462189   2.3734740   0.2422027
#>  [67]   1.6340084   2.3064114   0.5521217   4.2012845   0.2602349   2.1994602
#>  [73]   1.8434039   3.1044798   2.6432254   0.5536387   1.2007635   0.5671011
#>  [79]   8.4425541   0.5895482   0.7729137   5.2514130   0.9667564   1.9995614
#>  [85]   0.2853811   0.6014948   0.4700584   0.8759660   0.7907561   0.8095502
#>  [91]   1.1267387   0.9088418   4.9260793   0.3288626   0.8418634   0.3126978
#>  [97]  10.9972492   0.4174596   0.2256656   2.7560965