Skip to contents

Construct a distribution from its family name and parameter vector. The result is a lightweight object accepted by dist_pdf(), dist_cdf(), dist_quantile(), dist_random(), dist_moments(), and friends. All 38 factory-constructible families of the USACE-RMC Numerics library are supported; see distribution_names() for the list.

Usage

distribution(family, params)

Arguments

family

the distribution family name, e.g. "Normal", "LogNormal", "Gumbel", "GeneralizedExtremeValue".

params

numeric vector of parameters, in constructor order.

Value

An object of class corehydro_dist.

Details

Parameters are positional, in the same order as the C# constructor for the family (for example Normal takes c(mean, sd) and GeneralizedExtremeValue takes c(location, scale, shape)). Use dist_params() on a constructed object to see the parameter names.

See also

dist_fit() to estimate one from data, distribution_names().

Examples

d <- distribution("Normal", c(100, 15))
d
#> <corehydro_dist> Normal(µ = 100, σ = 15)
dist_cdf(d, 100)
#> [1] 0.5