hypervolume_estimate_probability {hypervolume}R Documentation

Estimate probability a given location

Description

Estimates probability density at one or more of points within or outside a hypervolume. The estimation is carried out as the weighted sum of the probability density of all subsampled random points in the input hypervolume, where the weights are proportional to the distance from the test point raised to a certain power. The default power, -1, corresponds to inverse distance weighting.

Usage

hypervolume_estimate_probability(hv, points, 
                reduction.factor = 1, weight.exponent = -1, 
                set.edges.zero = TRUE, edges.zero.distance.factor = 1,
                parallel = FALSE, n.cores = 1,
                verbose = TRUE, ...)

Arguments

hv

An input hypervolume

points

A m x n matrix of m points of dimensionality n (same as the input hypervolume). These are the points at which the probability is to be estimated.

reduction.factor

A value between 0 and 1 corresponding to a thinning factor applied to random points of the input hypervolume. Smaller values result in faster runtimes but lower accuracy.

weight.exponent

The exponent of the distance weights. Should be negative and probably does not need to be changed.

set.edges.zero

If TRUE, any test points more than a critical distance (multiplied by edges.zero.distance.factor) away from a random point in the input hypervolume are assumed to have probability zero. Otherwise the weighted sum is used with no further modification.

edges.zero.distance.factor

Positive number used to multiply the critical distance for set.edges.zero. Larger values lead to more stringent criteria for test points being set to zero.

parallel

If TRUE, uses multiple cores.

n.cores

Number of cores to use in parallel operation.

verbose

If TRUE, prints diagnostic progress messages.

...

Other arguments to be passed to pbsapply for parallelization.

Details

Identifies the uniformly random points enclosed within a hypersphere centered on the point of interest, then averages the probability density at each of these points.

Value

A vector of probability densities of length corresponding to m, the number of input points.

See Also

hypervolume_inclusion_test, hypervolume_redundancy

Examples

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')

new_points = data.frame(bill_length_mm=c(0,38), bill_depth_mm=c(0,18),flipper_length_mm=c(0,190))

probs <- hypervolume_estimate_probability(hv, points=new_points)
probs
# should give a zero value and a non-zero value

# example for parallel operation
# probs_new <- hypervolume_estimate_probability(hv, points=new_points, parallel=TRUE, n.cores=2)

[Package hypervolume version 3.1.4 Index]