Learn R Programming

hypervolume (version 3.1.4)

hypervolume_box: Hypervolume construction via hyperbox kernel density estimation

Description

Constructs a hypervolume from a set of observations via thresholding a kernel density estimate of the observations. Assumes an axis-aligned hyperbox kernel.

Usage

hypervolume_box(data, name = NULL, verbose = TRUE, samples.per.point =
                 ceiling((10^(3 + sqrt(ncol(data))))/nrow(data)),
                 kde.bandwidth = 2*estimate_bandwidth(data),
                 tree.chunksize = 10000)

Value

A Hypervolume-class object corresponding to the inferred hypervolume.

Arguments

data

A m x n matrix or data frame, where m is the number of observations and n is the dimensionality.

name

A string to assign to the hypervolume for later output and plotting. Defaults to the name of the variable if NULL.

verbose

Logical value; print diagnostic output if TRUE.

samples.per.point

Number of random points to be evaluated per data point in data.

kde.bandwidth

A scalar or a n x 1 vector corresponding to the half-width of the box kernel in each dimension. If a scalar input, the single value is used for all dimensions. Several esimation methods are available in estimate_bandwidth.

tree.chunksize

Number of random points to process per internal step. Larger values may have better performance on machines with large amounts of free memory. Changing this parameter does not change the output of the function; only how this output is internally assembled.

Details

Constructs a kernel density estimate by overlaying hyperbox kernels on each datapoint, then sampling uniformly random points from each kernel. Kernel density at each point is then determined by a range query on a recursive partitioning tree and used to resample these random points to a uniform density and fixed number, from which a volume can be inferred.

Note that when comparing among hypervolumes constructed with fixed bandwidth, volume will be approximately a an approximately linear function of the number of input data points.

Note that this function returns an unthresholded hypervolume. To assign a quantile threshold, use hypervolume_threshold.

See Also

hypervolume_threshold, estimate_bandwidth

Examples

Run this code
data(penguins,package='palmerpenguins')
penguins_no_na = as.data.frame(na.omit(penguins))
penguins_adelie = penguins_no_na[penguins_no_na$species=="Adelie",
                    c("bill_length_mm","bill_depth_mm","flipper_length_mm")]
hv = hypervolume_box(penguins_adelie,name='Adelie')
summary(hv)

Run the code above in your browser using DataLab