Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

depth.sample

Fast Depth Computation for Univariate and Bivariate Random Samples


Description

Faster implementation of the halfspace and the simplicial depth. Computes the depth of a whole random sample of a univariate or a bivariate data in one run.

Usage

depth.sample(A, B)

Arguments

A

Univariate or bivariate points whose depth is computed, represented by a matrix of size m*2. m stands for the number of points, d is 1 for univariate and 2 for bivariate data.

B

Random sample points with respect to which the depth of A is computed. B is represented by a matrix of size n*2, where n is the sample size.

Details

The function returns vectors of sample halfspace and simplicial depth values.

Value

Vector of length m of depth halfspace depth values is returned.

Author(s)

See Also

Examples

n = 100
m = 150
A = matrix(rnorm(2*n),ncol=2)
B = matrix(rnorm(2*m),ncol=2)
depth.sample(A,B)
system.time(D1<-depth.halfspace(A,B))
system.time(D2<-depth.sample(A,B))
max(D1-D2$Half)

A = rnorm(100)
B = rnorm(150)
depth.sample(A,B)
# depth.halfspace(matrix(A,ncol=1),matrix(B,ncol=1))

ddalpha

Depth-Based Classification and Calculation of Data Depth

v1.3.11
GPL-2
Authors
Oleksii Pokotylo [aut, cre], Pavlo Mozharovskyi [aut], Rainer Dyckerhoff [aut], Stanislav Nagy [aut]
Initial release
2020-01-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.