Computes the Tukey depth trimmed regions for given depth levels.
TukeyRegions(data, depths, method = "bfs",
trgFacets = FALSE, checkInnerPoint = TRUE,
retHalfspaces = TRUE, retHalfspacesNR = FALSE,
retInnerPoint = FALSE, retVertices = FALSE,
retFacets = FALSE, retVolume = FALSE, retBarycenter = FALSE,
verbosity = 0L)The function returns a list of objects of class TukeyRegion with fields specified by ret...-flags in the arguments:
the input data set.
chosen depth level.
whether at least one of the determining Tukey region halfspaces has been found.
if requested, halfspaces defining the Tukey region by their intersection, a matrix with number of columns equal to space dimension and where each row corresponds to a halfspace defined by three point numbers in data.
a logical indicating whether an inner point of the region has been found. If FALSE then the region of the given depth does not exist. If the field is absent then the inner point has not been requested by the input arguments.
coordinates of a point inside of the Tukey region. If the field is absent then either no halfspaces or no inner point have been found or facet computation has not been requested by the input arguments.
non-redundant halfspaces (i.e. those containing Tukey region's facets), a matrix with number of columns equal to space dimension and where each row corresponds to a halfspace defined by three point numbers in data. If the field is absent then either no halfspaces or no inner point have been found or facet computation has not been requested by the input arguments.
vertices of the Tukey region, a matrix with number of columns equal to space dimension and where each row represents vertex coordinates. If the field is absent then either no halfspaces or no inner point have been found or facet computation has not been requested by the input arguments. If field facets is returned, this field is returned as well.
a logical repeating the trgFacets input argument. If the field is absent then either no halfspaces or no inner point have been found or facet computation has not been requested by the input arguments.
facets of the Tukey region. If input argument trgFacets is set, then this is a list where each element is an array enumerating numbers of the rows in field vertices; their number for each facet can vary. If input argument trgFacets is unset, then this is a matrix with each row corresponding to a triangulated facet, and no facets' ridges reconstruction is performed. So it cannot be visualized. If the field is absent then either no halfspaces or no inner point have been found or facet computation has not been requested by the input arguments.
volume of the Tukey region. If the field is absent then either no halfspaces or no inner point have been found or facet computation has not been requested by the input arguments.
the barycenter of the Tukey region. If the field is absent then either no halfspaces or no inner point have been found or facet computation has not been requested by the input arguments.
number of used ridges.
data set for which the Tukey region shall be computed, a matrix having > 2 columns and more rows than columns.
depths of the Tukey regions to compute, a vector of integers between 1 and the half of the number of rows in data.
the method to use to compute the Tukey region, a string containing "bfs", or "cmb", or "bf", see `Details', "bfs" by default.
whether to triangulate facets, logical, FALSE by default. In this case no facet ridges are plotted, see `Value'.
whether to check correctness of the inner point in case it is provided, logical, TRUE by default.
whether to return all found halfspaces, logical, TRUE by default.
whether to return non-redundant halfspaces, logical, FALSE by default.
whether to return inner point, logical, FALSE by default.
whether to return vertices, logical, FALSE by default.
whether to return facets, logical, FALSE by default.
whether to return volume, logical, FALSE by default.
whether to return the region's barycenter, logical, FALSE by default.
level of details to print during execution, integer, from 0 (= print nothing) to 2 (= print all details).
Pavlo Mozharovskyi <pavlo.mozharovskyi@ensai.fr>
The function computes the Tukey regions (upper-level set of the Tukey depth function) for n points in the Euclidean d-variate space contained in data at the depth values specified in the argument depths. This function calls multiple times function TukeyRegion and provides computational convenience by shifting the loop on the C++ level.
The main difference with TukeyMedian is that arguments halfspaces and/or innerPoint cannot be provided here anymore.
Liu, X., Mosler, K., and Mozharovskyi, P. (2019). Fast computation of Tukey trimmed regions and median in dimension p > 2. Journal of Computational and Graphical Statistics, 28, 682-697.
TukeyRegion
TukeyMedian
# Load required packages
require(TukeyRegion)
require(MASS)
# Generate data
set.seed(1)
X <- mvrnorm(500, rep(0, 3),
matrix(c(1, 0.25, 0.25, 0.25, 1, 0.25, 0.25, 0.25, 1), nrow = 3))
# Compute the Tukey region
Trs <- TukeyRegions(X, c(5, 25), "bfs",
retFacets = TRUE, retVolume = TRUE, retBarycenter = TRUE)
summary(Trs[[1]])
summary(Trs[[2]])
# Visualize the Tukey region
plot(Trs[[2]], drawRidges = FALSE, colorFacets = "green", alpha = 1)
plot(Trs[[1]], drawRidges = FALSE, newPlot = FALSE, colorFacets = "blue",
alpha = 0.5)
Run the code above in your browser using DataLab