The previous tutorial we looked at how wrappers are used to extend functionality in distr6 to composite and transformed distributions. Now we will take a slight detour from the distribution interface to look at symbolic sets and intervals. We will keep this tutorial brief as whilst these objects form an integral part of making distr6 have pretty print methods, they are purely symbolic and have little mathematical functionality.

Sets, Intervals and SetIntervals

The class structure for these objects looks like: SetInterval -> Set, SetInterval -> Interval i.e. everything inherits from SetInterval, this means all methods from SetInterval are also in Set and Interval objects. Sets and intervals primarily differ in that sets expect discrete elements whereas intervals expect a range of numerics:

The type of interval can be changed to ensure the correct bounds are set

These also include basic accessors for the bounds of the interval

And a way of testing if an element lies in the set or interval


We have kept this very short as these are primarily meant to be used internally. We encourage you to look at the help pages in the documentation if you are interested in learning about sets further. In the next and final tutorial we conclude with running through how to construct your own custom distribution.