Statistical Depth Functions for Multivariate Analysis

Data depth concept offers a variety of powerful and user friendly tools for robust exploration and inference for multivariate data. The offered techniques may be successfully used in cases of lack of our knowledge on parametric models generating data due to their nature. The package consist of among others implementations of several data depth techniques involving multivariate quantile-quantile plots, multivariate scatter estimators, multivariate Wilcoxon tests and robust regressions.

DepthProc project consist of a set of statistical procedures based on so called statistical depth functions. The project involves free available R package and its description.


CRAN release version

GitHubstars GitHubwatchers

CRANversion Downloads BuildStatus AppVeyor BuildStatus CoverageStatus Project Status: Active - The project has reached a stable, usablestate and is being activelydeveloped.


DepthProc is avaiable on CRAN:


You can also install it from GitHub with devtools package:


Main features:

Speed and multithreading

Most of the code is written in C++ for additional efficiency. We also use OpenMP to speedup computations with multithreading:

d <- 10
x <- mvrnorm(1000, rep(0, d), diag(d))
# Default - utilize as many threads as possible
system.time(depth(x, x, method = "LP"))
#>    user  system elapsed 
#>   0.351   0.000   0.090
# Only single thread - 4 times slower:
system.time(depth(x, x, method = "LP", threads = 1))
#>    user  system elapsed 
#>   0.208   0.000   0.208
# Two threads - 2 times slower:
system.time(depth(x, x, method = "LP", threads = 2))
#>    user  system elapsed 
#>   0.201   0.000   0.103

Available depth functions

x <- mvrnorm(100, c(0, 0), diag(2))
depthEuclid(x, x)
depthMah(x, x)
depthLP(x, x)
depthProjection(x, x)
depthLocal(x, x)
depthTukey(x, x)
## Base function to call others:
depth(x, x, method = "Projection")
depth(x, x, method = "Local", depth_params1 = list(method = "LP"))
## Get median
  depth_params = list(
    method = "Local",
    depth_params1 = list(method = "LP")))

Basic plots

Contour plot

y <- rmvt(n = 200, sigma = diag(2), df = 4, delta = c(3, 5))
depthContour(y, points = TRUE, graph_params = list(lwd = 2))

Perspective plot

depthPersp(y, depth_params = list(method = "Mahalanobis"))

Functional depths:

There are two functional depths implemented - modified band depth (MBD), and Frainman-Muniz depth (FM):

x <- matrix(rnorm(60), nc = 20)
fncDepth(x, method = "MBD")
fncDepth(x, method = "FM", dep1d = "Mahalanobis")
#> Warning in dep1d_params$u <- u[, i]: Coercing LHS to a list

Functional BoxPlot

x <- matrix(rnorm(2000), ncol = 100)
fncBoxPlot(x, bands = c(0, 0.5, 1), method = "FM")


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2.1.3 by Zygmunt Zawadzki, a year ago,

Report a bug at

Browse source code at

Authors: Zygmunt Zawadzki [aut, cre] , Daniel Kosiorowski [aut] , Krzysztof Slomczynski [ctb] , Mateusz Bocian [ctb] , Anna Wegrzynkiewicz [ctb]

Documentation:   PDF Manual  

GPL-2 license

Imports lattice, sm, geometry, colorspace, zoo, grDevices

Depends on ggplot2, Rcpp, rrcov, methods, MASS, np

Suggests mvtnorm, rgl, sn, robustbase, dplyr, RcppArmadillo, xts, covr, testthat, fda, lintr

Linking to Rcpp, RcppArmadillo

System requirements: C++11

Imported by OptimaRegion.

See at CRAN