Learn R Programming

hypervolume (version 1.4.1)

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 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.

Examples

Run this code
# NOT RUN {
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