Learn R Programming

algebraic.dist (version 0.9.1)

conditional: Generic method for obtaining the conditional distribution of a distribution object x given condition P.

Description

Generic method for obtaining the conditional distribution of a distribution object x given condition P.

Usage

conditional(x, P, ...)

Value

A distribution object for the conditional distribution.

Arguments

x

The empirical distribution object.

P

The predicate function to condition x on

...

additional arguments to pass into P

Examples

Run this code
# \donttest{
d <- empirical_dist(1:100)
# condition on values greater than 50
d_gt50 <- conditional(d, function(x) x > 50)
mean(d_gt50)
# }

Run the code above in your browser using DataLab