The density(), mean(), and variance() methods are approximate as
they are based on numerical derivatives.
dist_transformed(dist, transform, inverse)# Create a log normal distribution
dist <- dist_transformed(dist_normal(0, 0.5), exp, log)
density(dist, 1) # dlnorm(1, 0, 0.5)
#> [1] 0.7978846
cdf(dist, 4) # plnorm(4, 0, 0.5)
#> [1] 0.9972194
quantile(dist, 0.1) # qlnorm(0.1, 0, 0.5)
#> [1] 0.5268835
generate(dist, 10) # rlnorm(10, 0, 0.5)
#> [[1]]
#> [1] 0.6242060 0.9536289 0.5683468 0.4828235 0.4276891 0.5377221 0.5891058
#> [8] 0.6857863 0.7463553 1.3219012
#>