dcov:

Usage Arguments Examples

Usage

1
dcov(m, tr = 0.2, dop = 1, cop = 2, pr = TRUE)

Arguments

m
tr
dop
cop
pr

Examples

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (m, tr = 0.2, dop = 1, cop = 2, pr = TRUE) 
{
    if (tr >= 0.5) 
        stop("Amount of trimming must be less than .5")
    if (is.list(m)) 
        m <- matl(m)
    if (!is.matrix(m)) 
        stop("Data must be stored in a matrix or in list mode.")
    if (ncol(m) == 1) {
        if (tr < 0.5) 
            val <- mean(m, tr)
    }
    if (ncol(m) > 1) {
        temp <- NA
        if (ncol(m) != 2) {
            if (dop == 1) 
                temp <- fdepth(m, plotit = FALSE, cop = cop)
            if (dop == 2) 
                temp <- fdepthv2(m)
        }
        if (ncol(m) == 2) {
            for (i in 1:nrow(m)) temp[i] <- depth(m[i, 1], m[i, 
                2], m)
        }
    }
    mdep <- max(temp)
    flag <- (temp == mdep)
    flag2 <- (temp >= tr)
    if (sum(flag2) == 0) 
        stop("Trimmed all of the data")
    if (sum(flag2) == 1) {
        if (pr) 
            print("Warning: Trimmed all but one point")
        val <- 0
    }
    if (sum(flag2) > 1) 
        val <- var(m[flag2, ])
    val
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.