covmtrim:

Usage Arguments Examples

Usage

1
covmtrim(x, tr = 0.2, p = length(x), grp = c(1:p))

Arguments

x
tr
p
grp

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
##---- 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 (x, tr = 0.2, p = length(x), grp = c(1:p)) 
{
    if (is.list(x)) 
        x = matl(x)
    x = elimna(x)
    x = listm(x)
    if (!is.list(x)) 
        stop("The data are not stored in list mode or a matrix.")
    p <- length(grp)
    pm1 <- p - 1
    for (i in 1:pm1) {
        ip <- i + 1
        if (length(x[[grp[ip]]]) != length(x[[grp[i]]])) 
            stop("The number of observations in each group must be equal")
    }
    n <- length(x[[grp[1]]])
    h <- length(x[[grp[1]]]) - 2 * floor(tr * length(x[[grp[1]]]))
    covest <- matrix(0, p, p)
    covest[1, 1] <- (n - 1) * winvar(x[[grp[1]]], tr)/(h * (h - 
        1))
    for (j in 2:p) {
        jk <- j - 1
        covest[j, j] <- (n - 1) * winvar(x[[grp[j]]], tr)/(h * 
            (h - 1))
        for (k in 1:jk) {
            covest[j, k] <- (n - 1) * wincor(x[[grp[j]]], x[[grp[k]]], 
                tr)$cov/(h * (h - 1))
            covest[k, j] <- covest[j, k]
        }
    }
    covmtrim <- covest
    covmtrim
  }

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