Learn R Programming

DepthProc (version 2.1.5)

depthLocal: Local depth

Description

Computes local version of depth according to proposals of Paindaveine and Van Bever --- see referencess.

Usage

depthLocal(
  u,
  X,
  beta = 0.5,
  depth_params1 = list(method = "Projection"),
  depth_params2 = depth_params1
)

Arguments

u

Numerical vector or matrix whose depth is to be calculated. Dimension has to be the same as that of the observations.

X

The data as a matrix, data frame. If it is a matrix or data frame, then each row is viewed as one multivariate observation.

beta

cutoff value for neighbourhood

depth_params1

list of parameters for function depth (method, threads, ndir, la, lb, pdim, mean, cov, exact).

depth_params2

as above --- default is depth_params1.

Details

A successful concept of local depth was proposed by Paindaveine and Van Bever (2012). For defining a neighbourhood of a point authors proposed using idea of symmetrisation of a distribution (a sample) with respect to a point in which depth is calculated. In their approach instead of a distribution \( {P} ^ {X} \), a distribution \( {{P}_{x}} = \frac{ 1 }{ 2 }{{P} ^ {X}} + \frac{ 1 }{ 2 }{{P} ^ {2x - X}} \) is used. For any \( \beta \in [0, 1] \), let us introduce the smallest depth region bigger or equal to \( \beta \), $$ {R} ^ {\beta}(F) = \bigcap\limits_{\alpha \in A(\beta)} {{{D}_{\alpha}}}(F), $$ where \( A(\beta) = \left\{ \alpha \ge 0:P\left[ {{D}_{\alpha}}(F)\right] \ge \beta\right\} \). Then for a locality parameter \( \beta \) we can take a neighbourhood of a point \( x \) as \( R_{x} ^ {\beta}(P) \).

Formally, let \( D(\cdot, P) \) be a depth function. Then the local depth with the locality parameter \( \beta \) and w.r.t. a point \( x \) is defined as $$ L{{D} ^ {\beta}}(z, P):z \to D(z, P_{x} ^ {\beta}), $$ where \( P_{x} ^ {\beta}(\cdot) = P\left( \cdot |R_{x} ^ {\beta}(P)\right) \) is cond. distr. of \( P \) conditioned on \( R_{x} ^ {\beta}(P) \).

References

Paindaveine, D., Van Bever, G. (2013) From depth to local depth : a focus on centrality. Journal of the American Statistical Association 105, 1105--1119.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# EXAMPLE 1
data <- mvrnorm(100, c(0, 5), diag(2) * 5)
# By default depth_params2 = depth_params1
depthLocal(data, data, depth_params1 = list(method = "LP"))
depthLocal(data, data, depth_params1 = list(method = "LP"),
           depth_params2 = list(method = "Projection"))
# Depth contour
depthContour(data, depth_params = list(method = "Local", depth_params1 = list(method = "LP")))

# EXAMPLE 2
data(inf.mort, maesles.imm)
data1990 <- na.omit(cbind(inf.mort[, 1], maesles.imm[, 1]))
depthContour(data1990,
             depth_params = list(
               method = "Local",
               depth_params1 = list(method = "LP"),
               beta = 0.3
             ))

# EXAMPLE 3
Sigma1 <- matrix(c(10, 3, 3, 2), 2, 2)
X1 <- mvrnorm(n = 8500, mu = c(0, 0), Sigma1)
Sigma2 <- matrix(c(10, 0, 0, 2), 2, 2)
X2 <- mvrnorm(n = 1500, mu = c(-10, 6), Sigma2)
BALLOT <- rbind(X1, X2)

train <- sample(1:10000, 100)
data <- BALLOT[train, ]
depthContour(data,
            depth_params = list(
              method = "Local",
              beta = 0.3,
              depth_params1 = list(method = "Projection")
            ))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab