Hyperbox, hyperball expectation

Description

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

Usage

1
2
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 is a data frame, defaults to 10*10^n, where n is the dimensionality.

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 input is a data frame, this argument is ignored.

Value

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

Author(s)

Benjamin Blonder

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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))