Description Usage Arguments Details References Examples

View source: R/depthLocal.R View source: R/depthLocal.R

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

1 2 | ```
depthLocal(u, X, beta = 0.5, depth1 = "Projection", depth2 = depth1,
name = "X", ...)
``` |

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

`depth1` |
depth method for symmetrised data |

`depth2` |
depth method for calculation depth of given point |

`name` |
name for this data set - it will be used on plots. |

`...` |
additional parameters passed to depth1 and depth2 |

A successful concept of local depth was proposed by Paidaveine 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}}=1/2{{P}^{X}}+1/2{{P}^{2x-X}} * is used. For any * β \in [0,1] * , let us introduce the smallest depth region bigger or equal to * β * ,

* {R}^{β }(F)=\bigcap\limits_{α \in A(β )}{{{D}_{α }}}(F), *

where * A(β )=≤ft\{ α ≥ 0:P≤ft[ {{D}_{α }}(F) \right]≥ β \right\} * . Then for a locality parameter * β * we can take a neighbourhood of a point * x * as * R_{x}^{β }(P) * .

Formally, let * D(\cdot,P) * be a depth function. Then the local depth with the locality parameter * β * and w.r.t. a point * x * is defined as

* L{{D}^{β }}(z,P):z\to D(z,P_{x}^{β }), *

where * P_{x}^{β }(\cdot )=P≤ft( \cdot |R_{x}^{β }(P) \right) * is cond. distr. of * P * conditioned on * R_{x}^{β }(P) * .

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
## Not run:
# EXAMPLE 1
data = mvrnorm(100, c(0,5), diag(2)*5)
#by default depth2 = depth1
depthLocal(data, data, depth1 = "LP")
depthLocal(data, data, depth1 = "LP", depth2 = "Projection")
## Depthcontour
depthContour(data, method = "Local", depth1 = "LP")
# EXAMPLE 2
data(inf.mort,maesles.imm)
data1990=na.omit(cbind(inf.mort[,1],maesles.imm[,1]))
depthContour(data1990, method = "Local", depth1 = "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, method = "Local", depth1 = "Projection",beta=0.3)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.