Falls back to MC: materializes x via ensure_realized() and then applies rmap with g to the resulting empirical distribution.

# S3 method for class 'dist'
rmap(x, g, n = 10000L, ...)

Arguments

x

The distribution object.

g

The function to apply to the distribution.

n

The number of samples to generate for the MC estimate of the conditional distribution x | P. Defaults to 10000.

...

additional arguments to pass into g.

Value

An empirical_dist of the transformed samples.

Examples

# \donttest{
set.seed(1)
x <- exponential(1)
# Distribution of log(X) where X ~ Exp(1)
log_x <- rmap(x, log)
mean(log_x)
#> [1] -0.5919414
# }