View source: R/depth.halfspace.r
depth.space.halfspace | R Documentation |
Calculates the representation of the training classes in depth space using the halfspace depth.
depth.space.halfspace(data, cardinalities, exact, method, num.directions = 1000, seed = 0)
data |
Matrix containing training sample where each row is a |
cardinalities |
Numerical vector of cardinalities of each class in |
exact |
The type of the used method. The default is |
method |
For For The name of the method may be given as well as just parameter |
num.directions |
Number of random directions to be generated. As the same direction set is used for all observations, the algorithmic complexity of calculating the depth of each single point in |
seed |
The random seed. The default value |
The depth representation is calculated in the same way as in depth.halfspace
, see References below for more information and details.
Matrix of objects, each object (row) is represented via its depths (columns) w.r.t. each of the classes of the training sample; order of the classes in columns corresponds to the one in the argument cardinalities
.
Cuesta-Albertos, J.A. and Nieto-Reyes, A. (2008). The random Tukey depth. Computational Statistics and Data Analysis 52 4979–4988.
Dyckerhoff, R. and Mozharovskyi, P. (2016). Exact computation of the halfspace depth. Computational Statistics and Data Analysis 98 19–30.
Mozharovskyi, P., Mosler, K., and Lange, T. (2015). Classifying real-world data with the DD\alpha
-procedure. Advances in Data Analysis and Classification 9 287–314.
Rousseeuw, P.J. and Ruts, I. (1996). Algorithm AS 307: Bivariate location depth. Journal of the Royal Statistical Society. Series C (Applied Statistics) 45 516–526.
Tukey, J.W. (1974). Mathematics and the picturing of data. In: Proceeding of the International Congress of Mathematicians, Vancouver, 523–531.
ddalpha.train
and ddalpha.classify
for application, depth.halfspace
for calculation of the Tukey depth.
# Generate a bivariate normal location-shift classification task
# containing 20 training objects
class1 <- mvrnorm(10, c(0,0),
matrix(c(1,1,1,4), nrow = 2, ncol = 2, byrow = TRUE))
class2 <- mvrnorm(10, c(1,1),
matrix(c(1,1,1,4), nrow = 2, ncol = 2, byrow = TRUE))
data <- rbind(class1, class2)
plot(data, col = c(rep(1,10), rep(2,10)))
# Get depth space using the random Tukey depth
dhA = depth.space.halfspace(data, c(10, 10))
(dhA)
# Get depth space using default exact method - "recursive"
dhE = depth.space.halfspace(data, c(10, 10), exact = TRUE)
(dhE)
data <- getdata("hemophilia")
cardinalities = c(sum(data$gr == "normal"), sum(data$gr == "carrier"))
depth.space.halfspace(data[,1:2], cardinalities)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.