TukeyKMedian | R Documentation |
Computes the Tukey median set and its barycenter, the Tukey median, starting from the region with dpeth 1
iteratively increasing it, according to the algorithm by Fojtik et al. (2022).
TukeyKMedian(data, algMedian = "upwards", method = "bfs",
trgFacets = TRUE, retHalfspaces = FALSE, retHalfspacesNR = FALSE,
retInnerPoint = FALSE, retVertices = TRUE, retFacets = TRUE,
retVolume = FALSE, retBarycenter = TRUE, verbosity = 0)
data |
data set for which the Tukey median shall be computed, a matrix having > 2 columns and more rows than columns. |
algMedian |
the algorithm used to compute the Tukey median, a string containing |
method |
the method to use to compute the Tukey region, a string containing |
trgFacets |
whether to triangulate facets, logical, |
retHalfspaces |
whether to return all found halfspaces, logical, |
retHalfspacesNR |
whether to return non-redundant halfspaces, logical, |
retInnerPoint |
whether to return inner point, logical, |
retVertices |
whether to return vertices, logical, |
retFacets |
whether to return facets, logical, |
retVolume |
whether to return volume, logical, |
retBarycenter |
whether to return the region's barycenter, logical, |
verbosity |
level of details to print during execution, integer, from |
The function computes the Tukey median set, i.e. the region with the highest depth value, for n
points in the Euclidean d
-variate space contained in data
.
It also computes this set's barycenter, which is the Tukey median. Four search algorithms are implemented: Algorithm bsbarydepth
is the most efficient, it is the bisection algorithm starting with the lower bound as the maximum of the theoretical minimum and the depth of the componentwise median, and updating lower bound with the depth of the barycenter of the last found region. Algorithm "cutintwo"
sequntially cuts the range of remaining depths into two parts starting with the range from 1
to the upper bound obtained by Liu, Luo, and Zuo (2016). Algorithm "downwards"
is checking each depth value decrementally with step 1
starting with the upper bound obtained by Liu, Luo, and Zuo (2016) until the first existing region is found. Algorithm "upwards"
is checking each depth value incrementally until the first non-existing region is found.
The main goal of the function is to provide the polytope (Tukey median set) and its barycenter (Tukey median); the settings can be adjusted though. After the median depth is found, the TukeyRegion
function is called.
See function TukeyRegion
for details regarding the output.
The function returns an object of class TukeyRegion
with fields specified by ret...
-flags in the arguments:
data |
the input data set. |
depth |
chosen depth level. |
numRegions |
number of time the depth region has been computed. |
halfspacesFound |
whether at least one of the determining Tukey region halfspaces has been found. |
halfspaces |
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 |
innerPointFound |
a logical indicating whether an inner point of the region has been found. If |
innerPoint |
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. |
halfspacesNR |
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 |
vertices |
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 |
triangulated |
a logical repeating the |
facets |
facets of the Tukey region. If input argument |
volume |
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. |
barycenter |
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. |
numRidges |
number of used ridges (for computing the last region). |
Pavlo Mozharovskyi <pavlo.mozharovskyi@ensai.fr>
Liu, X., Luo, S., and Zuo, Y. (2020). Some results on the computing of Tukey's halfspace median. Statistical Papers, 61, 303-316.
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.
Vit Fojtik, Petra Laketa, Pavlo Mozharovskyi, and Stanislav Nagy (2022). On exact computation of Tukey depth central regions. arXiv:2208.04587.
TukeyRegion
, depth.wm
# Load required packages
require(TukeyRegion)
require(MASS)
# Generate data
set.seed(1)
X <- mvrnorm(100, rep(0, 3),
matrix(c(1, 1, 1, 1, 2, 2, 1, 2, 4), nrow = 3))
# Compute the Tukey median
Tm <- TukeyKMedian(X)
summary(Tm)
# Visualize the Tukey median
plot(Tm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.