conditional.empirical_dist: Method for obtaining the condition distribution, 'x | P(x)',...

View source: R/empirical_dist.R

conditional.empirical_distR Documentation

Method for obtaining the condition distribution, x | P(x), of empirical_dist object x.

Description

In other words, we condition the data on the predicate function. In order to do so, we simply remove all rows from the data that do not satisfy the predicate P. For instance, if we have a 2-dimensional distribution, and we want to condition on the first dimension being greater than the second dimension, we would do the following:

Usage

## S3 method for class 'empirical_dist'
conditional(x, P, ...)

Arguments

x

The empirical distribution object.

P

The predicate function to condition the data on.

...

additional arguments to pass into P.

Details

x_cond <- conditional(x, function(d) d[1] > d[2])

This would return a new empirical distribution object with the same dimensionality as x, but with all rows where the first dimension is less than or equal to the second dimension removed.


queelius/algebraic.dist documentation built on Jan. 27, 2025, 8:46 a.m.