Learn R Programming

⚠️There's a newer version (2.1.5) of this package.Take me there.

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.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
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

367

Version

2.1.4

License

GPL-2

Issues

Pull Requests

Stars

Forks

Maintainer

Zygmunt Zawadzki

Last Published

November 6th, 2021

Functions in DepthProc (2.1.4)

FunctionalDepth-class

Functional Depth
depthContour

Approximate depth contours
TrimReg2d-class

TrimReg2d
ScaleCurve-class

ScaleCurve and ScaleCurveList
depth

Depth calculation
getPlot

Create ggplot object from DepthCurve, DepthCurveList and DDPlot classes.
LSDepthContour-class

Location-Scale depth contour class
depthPersp

Perspective plot for depth functions
RobReg-class

RobReg
depthProjection

Projection Depth
fncDepth

Basic function for functional depths
inf.mort

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

Multivariate Wilcoxon test for equality of dispersion.
USLABOUR

US Labour dataset
maesles.imm

Children 1 year old immunized against measles, percentage
depthDensity

Depth weighted density estimator
LSDepth-class

Location-Scale depth class
abline,RobReg,ANY,ANY,ANY-method

Add line to plot
depthEuclid

Euclidean Depth
binningDepth2D

2d Binning
BinnDepth2d-class

BinnDepth2d
as.matrix

as.matrix method for DepthCurveList.
fncDepthFM

FM Depth
lsdAddContour

Adds location scale depth contour to the existing plot.
asymmetryCurve

Asymmetry curve based on depths
combineDepthCurves

Adds plots
ddmvnorm

Normal depth versus depth plot
cracow.airpollution

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

Simple deepest regression method.
lsdGetContour

Get location-scale contour from LSDepthContour object.
plot,BinnDepth2d,ANY-method

2d Binning plot
plot,DepthDensity,ANY-method

Plot function for DepthDensity.
depthTukey

Tukey Depth
fncDepthMBD

Modified band depth
fncDepthMedian

Functional median
fncBoxPlot

Functional boxplot based on Modified Band Depth
depthMedian

Depth median
plot,LSDepthContour,ANY-method

Plot Location-Scale depth contours.
depthMah

Mahalanobis Depth
ddPlot

Depth versus depth plot
internet.users

Internet view data
lsdSampleDepthContours

Calculate sample Mizera and Muller Student depth contours
katowice.airpollution

Air pollution in Katowice city by hour.
depthLP

LP Depth
lsdSampleMaxDepth

Calculates the maximum sample location-scale depth
depthLocal

Local depth
fncGetBand

Functional bands
runifsphere

Random number generation from unit sphere.
france

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

Method for plotting DepthCurve and DDPlot object.
scaleCurve

Scale curve
trimProjReg2d

trimProjReg2d
under5.mort

Children under 5 months mortality rate per 1,000 live births
DepthDensity-class

DepthDensity
DepthCurveList-class

DepthCurveList
DDPlot-class

DDPlot
DeepReg2d-class

DeepReg2d
CovDepthWeighted-class

CovLP
CovLP

CovLp
AsymmetryCurve-class

AsymmetryCurve and AsymmetryCurveList
Depth-class

Depth
DepthCurve-class

DepthCurve