Learn R Programming

DepthProc

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.

Versions

CRAN release version

Installation

DepthProc is avaiable on CRAN:

install.packages("DepthProc")

You can also install it from GitHub with devtools package:

library(devtools)
install_github("zzawadz/DepthProc")

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:

library(DepthProc)
set.seed(123)

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.408   0.054   0.033

# Only single thread - 4 times slower:
system.time(depth(x, x, method = "LP", threads = 1))
#>    user  system elapsed 
#>   0.039   0.000   0.039

# Two threads - 2 times slower:
system.time(depth(x, x, method = "LP", threads = 2))
#>    user  system elapsed 
#>   0.036   0.000   0.020

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
depthMedian(x, 
  depth_params = list(
    method = "Local",
    depth_params1 = list(method = "LP")))

Basic plots

Contour plot

library(mvtnorm)
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")

Copy Link

Version

Install

install.packages('DepthProc')

Monthly Downloads

930

Version

2.1.6

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Zygmunt Zawadzki

Last Published

October 11th, 2025

Functions in DepthProc (2.1.6)

DepthCurveList-class

DepthCurveList
ScaleCurve-class

ScaleCurve and ScaleCurveList
as.matrix

as.matrix method for DepthCurveList.
abline,RobReg-method

Add line to plot
TrimReg2d-class

TrimReg2d
combineDepthCurves

Adds plots
USLABOUR

US Labour dataset
FunctionalDepth-class

Functional Depth
cracow.airpollution

Air pollution with PM10 in Cracow within day and night in December 2016
ddmvnorm

Normal depth versus depth plot
LSDepthContour-class

Location-Scale depth contour class
RobReg-class

RobReg
plot

Method for plotting DepthCurve and DDPlot object.
asymmetryCurve

Asymmetry curve based on depths
binningDepth2D

2d Binning
trimProjReg2d

trimProjReg2d
deepReg2d

Simple deepest regression method.
plot,LSDepthContour,ANY-method

Plot Location-Scale depth contours.
under5.mort

Children under 5 months mortality rate per 1,000 live births
depthDensity

Depth weighted density estimator
LSDepth-class

Location-Scale depth class
depthLP

LP Depth
fncBoxPlot

Functional boxplot based on Modified Band Depth
fncDepthMBD

Modified band depth
fncDepthMedian

Functional median
depthContour

Approximate depth contours
depthTukey

Tukey Depth
depthEuclid

Euclidean Depth
depthMah

Mahalanobis Depth
depth

Depth calculation
fncDepth

Basic function for functional depths
lsdSampleDepthContours

Calculate sample Mizera and Muller Student depth contours
depthMedian

Depth median
internet.users

Internet view data
katowice.airpollution

Air pollution in Katowice city by hour.
fncDepthFM

FM Depth
lsdAddContour

Adds location scale depth contour to the existing plot.
lsdGetContour

Get location-scale contour from LSDepthContour object.
depthLocal

Local depth
mWilcoxonTest

Multivariate Wilcoxon test for equality of dispersion.
ddPlot

Depth versus depth plot
plot,DepthDensity,ANY-method

Plot function for DepthDensity.
plot,BinnDepth2d,ANY-method

2d Binning plot
getPlot

Create ggplot object from DepthCurve, DepthCurveList and DDPlot classes.
lsdSampleMaxDepth

Calculates the maximum sample location-scale depth
maesles.imm

Children 1 year old immunized against measles, percentage
fncGetBand

Functional bands
runifsphere

Random number generation from unit sphere.
depthPersp

Perspective plot for depth functions
france

Relation between minimum wage (MW) and unemployment rate (UR) in France.
scaleCurve

Scale curve
depthProjection

Projection Depth
inf.mort

Infant mortality rate (0--1 year) per 1,000 live births
DDPlot-class

DDPlot
DeepReg2d-class

DeepReg2d
AsymmetryCurve-class

AsymmetryCurve and AsymmetryCurveList
BinnDepth2d-class

BinnDepth2d
DepthDensity-class

DepthDensity
CovLP

CovLp
CovDepthWeighted-class

CovLP
DepthCurve-class

DepthCurve
Depth-class

Depth