powered by
x | P(x)
dist
x
Falls back to MC: materializes x via ensure_realized() and then conditions on the resulting empirical distribution.
ensure_realized()
# S3 method for dist conditional(x, P, n = 10000L, ...)
An empirical_dist approximating the conditional distribution.
empirical_dist
The distribution object.
The predicate function to condition the distribution on
The number of samples to generate for the MC estimate of the conditional distribution x | P. Defaults to 10000.
additional arguments to pass into P.
P
# \donttest{ set.seed(1) x <- exponential(1) # Condition on X > 2 x_gt2 <- conditional(x, function(t) t > 2) mean(x_gt2) # }
Run the code above in your browser using DataLab