Computes the Tukey depth of a point or vectors of points with respect to a multivariate data set.

depthTukey(u, X, ndir = 1000, threads = -1, exact = FALSE)

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 or list. If it is a matrix or data frame, then each row is viewed as one multivariate observation. If it is a list, all components must be numerical vectors of equal length (coordinates of observations).

ndir

number of directions used in computations

threads

number of threads used in parallel computations. Default value -1 means that all possible cores will be used.

exact

if TRUE exact alhorithm will be used . Currently it works only for 2 dimensional data set.

Details

Irrespective of dimension, Projection and Tukey's depth is obtained by approximate calculation.

Returns the depth of multivariate point u with respect to data set X.

Examples

if (FALSE) { x <- matrix(rnorm(3000), nc = 3) depthTukey(x, ndir = 2000) } # Exact algorithm in 2d x <- matrix(rnorm(2000), nc = 2) depthTukey(x, exact = TRUE)
#> Depth method: Tukey #> [1] 0.113 0.010 0.147 0.009 0.005 0.083 0.180 0.092 0.033 0.223 0.052 0.078 #> [13] 0.137 0.197 0.066 0.020 0.008 0.046 0.346 0.132 0.365 0.057 0.123 0.005 #> [25] 0.049 0.005 0.359 0.014 0.033 0.014 0.026 0.023 0.132 0.342 0.053 0.059 #> [37] 0.107 0.109 0.033 0.230 0.099 0.114 0.166 0.159 0.253 0.047 0.011 0.068 #> [49] 0.161 0.319 0.031 0.027 0.115 0.011 0.084 0.158 0.008 0.210 0.234 0.099 #> [61] 0.201 0.185 0.119 0.015 0.134 0.134 0.035 0.083 0.143 0.130 0.035 0.245 #> [73] 0.256 0.354 0.157 0.023 0.228 0.006 0.060 0.142 0.065 0.162 0.048 0.145 #> [85] 0.348 0.084 0.056 0.107 0.036 0.191 0.292 0.007 0.166 0.363 0.017 0.001 #> [97] 0.208 0.343 0.090 0.352 0.251 0.285 0.355 0.289 0.057 0.080 0.179 0.003 #> [109] 0.038 0.154 0.064 0.071 0.162 0.029 0.029 0.047 0.268 0.367 0.006 0.023 #> [121] 0.036 0.203 0.128 0.039 0.052 0.227 0.032 0.047 0.259 0.064 0.032 0.032 #> [133] 0.029 0.180 0.091 0.008 0.125 0.014 0.045 0.373 0.030 0.240 0.334 0.021 #> [145] 0.001 0.248 0.394 0.016 0.078 0.011 0.048 0.053 0.086 0.230 0.039 0.140 #> [157] 0.073 0.381 0.289 0.374 0.251 0.348 0.301 0.320 0.178 0.005 0.231 0.140 #> [169] 0.237 0.228 0.116 0.008 0.180 0.099 0.357 0.111 0.205 0.036 0.004 0.243 #> [181] 0.132 0.022 0.435 0.233 0.028 0.192 0.449 0.016 0.033 0.358 0.031 0.281 #> [193] 0.038 0.180 0.114 0.085 0.287 0.138 0.075 0.285 0.429 0.048 0.067 0.119 #> [205] 0.387 0.132 0.149 0.207 0.182 0.001 0.055 0.077 0.035 0.163 0.015 0.009 #> [217] 0.043 0.210 0.155 0.422 0.038 0.034 0.001 0.018 0.404 0.178 0.047 0.054 #> [229] 0.269 0.006 0.139 0.067 0.078 0.319 0.223 0.158 0.189 0.069 0.159 0.057 #> [241] 0.080 0.195 0.253 0.010 0.123 0.179 0.091 0.033 0.089 0.247 0.002 0.092 #> [253] 0.086 0.023 0.411 0.045 0.217 0.131 0.090 0.049 0.411 0.190 0.053 0.112 #> [265] 0.231 0.325 0.058 0.012 0.097 0.152 0.347 0.130 0.231 0.159 0.292 0.196 #> [277] 0.280 0.019 0.184 0.036 0.278 0.169 0.239 0.040 0.002 0.168 0.166 0.196 #> [289] 0.095 0.126 0.237 0.209 0.063 0.106 0.094 0.216 0.250 0.110 0.057 0.404 #> [301] 0.259 0.003 0.027 0.170 0.240 0.188 0.101 0.182 0.010 0.287 0.067 0.243 #> [313] 0.092 0.009 0.043 0.429 0.138 0.231 0.097 0.017 0.065 0.199 0.225 0.242 #> [325] 0.055 0.087 0.115 0.231 0.273 0.060 0.193 0.065 0.111 0.296 0.065 0.001 #> [337] 0.346 0.087 0.215 0.420 0.093 0.053 0.311 0.189 0.238 0.065 0.028 0.122 #> [349] 0.300 0.085 0.109 0.135 0.014 0.219 0.044 0.172 0.030 0.282 0.091 0.204 #> [361] 0.019 0.244 0.013 0.139 0.087 0.115 0.095 0.077 0.017 0.024 0.013 0.216 #> [373] 0.138 0.179 0.088 0.194 0.154 0.240 0.033 0.161 0.073 0.032 0.134 0.221 #> [385] 0.086 0.188 0.360 0.312 0.170 0.047 0.050 0.051 0.042 0.017 0.364 0.038 #> [397] 0.325 0.087 0.141 0.272 0.073 0.051 0.360 0.053 0.306 0.162 0.005 0.071 #> [409] 0.279 0.264 0.004 0.178 0.055 0.132 0.276 0.190 0.046 0.169 0.002 0.136 #> [421] 0.056 0.004 0.263 0.105 0.031 0.015 0.037 0.199 0.024 0.075 0.200 0.185 #> [433] 0.277 0.007 0.122 0.308 0.214 0.074 0.239 0.014 0.418 0.160 0.086 0.423 #> [445] 0.129 0.155 0.242 0.163 0.390 0.047 0.311 0.355 0.220 0.333 0.019 0.084 #> [457] 0.026 0.030 0.099 0.034 0.225 0.285 0.189 0.054 0.109 0.371 0.168 0.051 #> [469] 0.103 0.110 0.215 0.196 0.047 0.075 0.213 0.195 0.172 0.007 0.223 0.079 #> [481] 0.106 0.380 0.236 0.078 0.225 0.364 0.013 0.271 0.243 0.089 0.014 0.002 #> [493] 0.009 0.075 0.089 0.255 0.294 0.170 0.120 0.073 0.287 0.017 0.282 0.104 #> [505] 0.041 0.126 0.095 0.001 0.169 0.085 0.166 0.050 0.385 0.098 0.158 0.071 #> [517] 0.062 0.132 0.289 0.270 0.158 0.016 0.211 0.004 0.153 0.040 0.192 0.005 #> [529] 0.197 0.368 0.353 0.379 0.033 0.049 0.186 0.253 0.026 0.174 0.149 0.175 #> [541] 0.150 0.018 0.059 0.388 0.370 0.137 0.298 0.122 0.096 0.010 0.005 0.291 #> [553] 0.142 0.276 0.184 0.368 0.097 0.061 0.027 0.305 0.272 0.115 0.062 0.334 #> [565] 0.021 0.104 0.041 0.002 0.002 0.225 0.330 0.184 0.079 0.285 0.113 0.351 #> [577] 0.011 0.175 0.138 0.012 0.088 0.190 0.124 0.245 0.054 0.076 0.008 0.087 #> [589] 0.003 0.043 0.394 0.337 0.218 0.148 0.374 0.018 0.313 0.229 0.273 0.337 #> [601] 0.036 0.245 0.120 0.023 0.264 0.183 0.102 0.012 0.077 0.160 0.078 0.123 #> [613] 0.226 0.078 0.278 0.122 0.384 0.068 0.077 0.135 0.235 0.010 0.170 0.071 #> [625] 0.100 0.094 0.402 0.035 0.127 0.087 0.071 0.015 0.179 0.005 0.243 0.194 #> [637] 0.253 0.030 0.347 0.051 0.026 0.111 0.084 0.160 0.126 0.327 0.052 0.218 #> [649] 0.277 0.133 0.347 0.001 0.176 0.224 0.038 0.298 0.111 0.295 0.005 0.270 #> [661] 0.110 0.068 0.040 0.256 0.213 0.028 0.295 0.001 0.009 0.230 0.242 0.016 #> [673] 0.127 0.125 0.002 0.203 0.238 0.163 0.311 0.120 0.029 0.006 0.025 0.103 #> [685] 0.090 0.130 0.408 0.163 0.219 0.026 0.140 0.298 0.035 0.350 0.195 0.266 #> [697] 0.311 0.023 0.149 0.260 0.259 0.203 0.038 0.176 0.049 0.090 0.001 0.001 #> [709] 0.268 0.116 0.137 0.335 0.351 0.061 0.200 0.060 0.385 0.003 0.085 0.217 #> [721] 0.150 0.014 0.112 0.116 0.237 0.308 0.396 0.008 0.019 0.306 0.053 0.030 #> [733] 0.026 0.144 0.007 0.049 0.102 0.315 0.152 0.276 0.098 0.291 0.113 0.294 #> [745] 0.074 0.071 0.150 0.097 0.101 0.337 0.207 0.141 0.412 0.085 0.006 0.173 #> [757] 0.353 0.084 0.003 0.278 0.016 0.003 0.077 0.047 0.062 0.013 0.197 0.077 #> [769] 0.020 0.247 0.090 0.043 0.032 0.281 0.362 0.039 0.242 0.095 0.119 0.082 #> [781] 0.260 0.067 0.026 0.325 0.019 0.023 0.020 0.089 0.286 0.279 0.274 0.009 #> [793] 0.145 0.026 0.035 0.116 0.039 0.109 0.050 0.118 0.022 0.063 0.116 0.350 #> [805] 0.314 0.201 0.040 0.177 0.081 0.385 0.022 0.097 0.235 0.044 0.031 0.064 #> [817] 0.281 0.370 0.124 0.116 0.249 0.076 0.266 0.107 0.156 0.074 0.252 0.137 #> [829] 0.049 0.134 0.101 0.158 0.321 0.001 0.109 0.362 0.098 0.002 0.101 0.172 #> [841] 0.112 0.030 0.416 0.037 0.038 0.377 0.118 0.054 0.066 0.030 0.345 0.059 #> [853] 0.118 0.072 0.166 0.060 0.165 0.098 0.140 0.073 0.296 0.026 0.171 0.016 #> [865] 0.229 0.077 0.321 0.090 0.358 0.005 0.013 0.046 0.163 0.126 0.054 0.259 #> [877] 0.087 0.135 0.208 0.008 0.011 0.022 0.226 0.061 0.026 0.198 0.179 0.002 #> [889] 0.039 0.028 0.152 0.154 0.017 0.144 0.130 0.348 0.082 0.053 0.081 0.004 #> [901] 0.136 0.368 0.290 0.127 0.194 0.111 0.070 0.001 0.150 0.120 0.024 0.039 #> [913] 0.027 0.114 0.457 0.269 0.081 0.004 0.108 0.108 0.001 0.128 0.024 0.180 #> [925] 0.011 0.298 0.245 0.057 0.054 0.409 0.029 0.153 0.172 0.144 0.199 0.197 #> [937] 0.268 0.003 0.283 0.290 0.093 0.063 0.141 0.268 0.454 0.001 0.227 0.104 #> [949] 0.005 0.220 0.014 0.005 0.023 0.060 0.094 0.228 0.168 0.083 0.387 0.416 #> [961] 0.064 0.433 0.140 0.159 0.087 0.253 0.067 0.198 0.140 0.084 0.228 0.326 #> [973] 0.013 0.214 0.233 0.016 0.006 0.013 0.143 0.122 0.322 0.240 0.286 0.042 #> [985] 0.009 0.013 0.120 0.026 0.095 0.023 0.058 0.031 0.301 0.098 0.007 0.134 #> [997] 0.046 0.099 0.180 0.395