depth.space.projection: Calculate Depth Space using Projection Depth

View source: R/depth.projection.r

depth.space.projectionR Documentation

Calculate Depth Space using Projection Depth

Description

Calculates the representation of the training classes in depth space using projection depth.

Usage

depth.space.projection(data, cardinalities, 
                       method = "random", num.directions = 1000, seed = 0)

Arguments

data

Matrix containing training sample where each row is a d-dimensional object, and objects of each class are kept together so that the matrix can be thought of as containing blocks of objects representing classes.

cardinalities

Numerical vector of cardinalities of each class in data, each entry corresponds to one class.

method

to be used in calculations.

"random" Here the depth is determined as the minimum univariate depth of the data projected on lines in several directions. The directions are distributed uniformly on the (d-1)-sphere; the same direction set is used for all points.

"linearize" The Nelder-Mead method for function minimization, taken from Olsson, Journal of Quality Technology, 1974, 6, 56. R-codes of this function were written by Subhajit Dutta.

num.directions

Number of random directions to be generated for method = "random". With the growth of n the complexity grows linearly for the same number of directions.

seed

the random seed. The default value seed=0 makes no changes.

Details

The depth representation is calculated in the same way as in depth.projection, see 'References' for more information and details.

Value

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.

References

Donoho, D.L. (1982). Breakdown properties of multivariate location estimators. Ph.D. qualifying paper. Department of Statistics, Harvard University.

Liu, R.Y. (1992). Data depth and multivariate rank tests. In: Dodge, Y. (ed.), L1-Statistics and Related Methods, North-Holland (Amsterdam), 279–294.

Liu, X. and Zuo, Y. (2014). Computing projection depth and its associated estimators. Statistics and Computing 24 51–63.

Stahel, W.A. (1981). Robust estimation: infinitesimal optimality and covariance matrix estimators. Ph.D. thesis (in German). Eidgenossische Technische Hochschule Zurich.

Zuo, Y.J. and Lai, S.Y. (2011). Exact computation of bivariate projection depth and the Stahel-Donoho estimator. Computational Statistics and Data Analysis 55 1173–1179.

See Also

ddalpha.train and ddalpha.classify for application, depth.projection for calculation of projection depth.

Examples

# 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(2,2), 
                  matrix(c(1,1,1,4), nrow = 2, ncol = 2, byrow = TRUE))
data <- rbind(class1, class2)
# Get depth space using projection depth
depth.space.projection(data, c(10, 10), method = "random", num.directions = 1000)
depth.space.projection(data, c(10, 10), method = "linearize")

data <- getdata("hemophilia")
cardinalities = c(sum(data$gr == "normal"), sum(data$gr == "carrier"))
depth.space.projection(data[,1:2], cardinalities)

ddalpha documentation built on Oct. 1, 2024, 1:07 a.m.