Density, log-density, distribution, quantile, and random-generation
functions for a distribution() object. All are vectorized over their
first numeric argument and evaluate in the shared C++ core, so results are
identical to the Python package and to the upstream C# library.
Usage
dist_pdf(d, x)
dist_log_pdf(d, x)
dist_cdf(d, q)
dist_quantile(d, p)
dist_random(d, n, seed = NULL)Arguments
- d
a
corehydro_distobject fromdistribution()ordist_fit().- x, q
numeric vector of quantiles.
- p
numeric vector of probabilities in
(0, 1).- n
number of draws.
- seed
integer seed for reproducible draws;
NULL(the default) seeds from the clock.
Details
dist_random() draws from the same seeded Mersenne Twister stream as the
C# GenerateRandomValues(sampleSize, seed): a given seed reproduces the
C# draws bit-for-bit (and matches corehydropy exactly).
Examples
d <- distribution("Gumbel", c(100, 10))
dist_pdf(d, c(95, 100, 120))
#> [1] 0.03170419 0.03678794 0.01182050
dist_quantile(d, c(0.5, 0.9, 0.99))
#> [1] 103.6651 122.5037 146.0015
dist_random(d, 5, seed = 123)
#> [1] 110.16852 110.83714 97.75836 101.65426 96.05623