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

449

Version

2.1.5

License

GPL-2

Issues

Pull Requests

Stars

Forks

Last Published

February 3rd, 2022

Functions in DepthProc (2.1.5)

AsymmetryCurve-class

AsymmetryCurve and AsymmetryCurveList
CovLP

CovLp
RobReg-class

RobReg
LSDepthContour-class

Location-Scale depth contour class
CovDepthWeighted-class

CovLP
depth

Depth calculation
ddmvnorm

Normal depth versus depth plot
depthPersp

Perspective plot for depth functions
deepReg2d

Simple deepest regression method.
depthProjection

Projection Depth
Depth-class

Depth
internet.users

Internet view data
as.matrix

as.matrix method for DepthCurveList.
depthContour

Approximate depth contours
DDPlot-class

DDPlot
DeepReg2d-class

DeepReg2d
BinnDepth2d-class

BinnDepth2d
DepthCurve-class

DepthCurve
USLABOUR

US Labour dataset
FunctionalDepth-class

Functional Depth
LSDepth-class

Location-Scale depth class
mWilcoxonTest

Multivariate Wilcoxon test for equality of dispersion.
katowice.airpollution

Air pollution in Katowice city by hour.
fncBoxPlot

Functional boxplot based on Modified Band Depth
getPlot

Create ggplot object from DepthCurve, DepthCurveList and DDPlot classes.
cracow.airpollution

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

Asymmetry curve based on depths
ScaleCurve-class

ScaleCurve and ScaleCurveList
TrimReg2d-class

TrimReg2d
depthTukey

Tukey Depth
depthDensity

Depth weighted density estimator
inf.mort

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

Depth versus depth plot
depthEuclid

Euclidean Depth
lsdAddContour

Adds location scale depth contour to the existing plot.
maesles.imm

Children 1 year old immunized against measles, percentage
plot,LSDepthContour,ANY-method

Plot Location-Scale depth contours.
depthMedian

Depth median
depthMah

Mahalanobis Depth
combineDepthCurves

Adds plots
binningDepth2D

2d Binning
plot

Method for plotting DepthCurve and DDPlot object.
trimProjReg2d

trimProjReg2d
under5.mort

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

Get location-scale contour from LSDepthContour object.
runifsphere

Random number generation from unit sphere.
abline,RobReg-method

Add line to plot
depthLocal

Local depth
fncDepthMedian

Functional median
fncDepthMBD

Modified band depth
scaleCurve

Scale curve
lsdSampleDepthContours

Calculate sample Mizera and Muller Student depth contours
fncDepth

Basic function for functional depths
fncDepthFM

FM Depth
lsdSampleMaxDepth

Calculates the maximum sample location-scale depth
fncGetBand

Functional bands
plot,DepthDensity,ANY-method

Plot function for DepthDensity.
depthLP

LP Depth
france

Relation between minimum wage (MW) and unemployment rate (UR) in France.
plot,BinnDepth2d,ANY-method

2d Binning plot
DepthCurveList-class

DepthCurveList
DepthDensity-class

DepthDensity