Learn R Programming

hypervolume (version 1.3.0)

expectation_box: Hyperbox, hyperball expectation

Description

Creates a hypervolume with geometry of the minimum hyperbox (hyperball) enclosing a set of points

Usage

expectation_box(input, npoints = NULL, userandom = FALSE)
expectation_ball(input, npoints = NULL, userandom = FALSE)

Arguments

input
A data frame or hypervolume object whose data are enclosed by the output hypervolume.
npoints
The number of random points in the output hypervolume. If NULL and input is of class Hypervolume, defaults to a value that matches the point density of the input hypervolume; if NULL and input
userandom
If input is a hypervolume and userandom is TRUE, the output hypervolume will enclose the uniformly random points defining the hypervolume; otherwise, it will enclose the data points used to build the hypervolume. If

Value

  • A Hypervolume object containing a uniformly random set of points sampled from the hyperbox (hyperball) enclosing the input data.

Examples

Run this code
data(iris)
hv1 = hypervolume(subset(iris, Species=="setosa")[,1:4],bandwidth=0.2)

hvboxdata = expectation_box(hv1, userandom=FALSE)
hvboxrandom = expectation_box(hv1, userandom=TRUE)

# show the two expectations
#plot(hypervolume_join(hv1, hvboxdata))
#plot(hypervolume_join(hv1, hvboxrandom))


# ball expectation
hvballdata = expectation_ball(hv1@Data, userandom=FALSE, npoints=10000)
hvballrandom = expectation_ball(hv1, userandom=TRUE, npoints=10000)

# show the two expectations
#plot(hypervolume_join(hv1, hvballdata))
#plot(hypervolume_join(hv1, hvballrandom))

Run the code above in your browser using DataLab