dfried:

Usage Arguments Examples

Usage

1
dfried(m, plotit = TRUE, pop = 0, fr = 0.8, v2 = FALSE, op = FALSE)

Arguments

m
plotit
pop
fr
v2
op

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
##---- 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, plotit = TRUE, pop = 0, fr = 0.8, v2 = FALSE, op = FALSE) 
{
    if (is.list(m)) 
        m <- matl(m)
    if (!is.matrix(m)) 
        stop("m should be a matrix having at least 2 columns.")
    m <- elimna(m)
    library(MASS)
    K <- ncol(m)
    n <- nrow(m)
    if (n <= 10 && !op) 
        print("With n<=10, might want to use op=T")
    J <- (K^2 - K)/2
    dcen <- cov.mcd(m)$center
    center <- NA
    pval <- matrix(NA, ncol = J, nrow = nrow(m))
    zvec <- rep(0, J)
    ic <- 0
    for (k in 1:K) {
        for (kk in 1:K) {
            if (k < kk) {
                ic <- ic + 1
                pval[, ic] <- m[, k] - m[, kk]
                center[ic] <- dcen[k] - dcen[kk]
            }
        }
    }
    pval0 <- rbind(pval, zvec)
    if (ncol(pval) == 1) 
        temp <- unidepth(as.vector(pval0))
    if (!v2) {
        if (ncol(pval) > 1) 
            temp <- fdepth(pval0, center = center)
    }
    if (v2) {
        if (ncol(pval) > 1) 
            temp <- fdepthv2(pval0)
    }
    big.dep <- max(temp)
    if (op) {
        v3 <- dmean(pval, tr = 0.5, dop = 2)
        v3 <- t(as.matrix(v3))
        big.dep <- max(max(temp), fdepthv2(pval0, v3))
    }
    phat <- temp[nrow(m) + 1]/big.dep
    if (K == 2) 
        crit <- 0.95 - 1.46/n^0.5
    if (K == 3) 
        crit <- 1 - 1.71/n^0.5
    if (K == 4) 
        crit <- 1.06 - 1.77/n^0.5
    if (K == 5) 
        crit <- 1.11 - 1.76/n^0.5
    if (K == 6) 
        crit <- 1.41 - 1.62/n^0.3
    if (K == 7) 
        crit <- 1.49 - 1.71/n^0.3
    if (K >= 8) 
        crit <- 1.39 - 1.38/n^0.3
    crit <- min(c(crit, 1))
    if (plotit && ncol(pval) == 1) {
        if (pop == 0) 
            akerd(pval, fr = fr)
        if (pop == 1) 
            rdplot(pval, fr = fr)
        if (pop == 2) 
            kdplot(pval)
        if (pop == 3) 
            skerd(pval)
        if (pop == 4) 
            boxplot(pval)
    }
    list(phat = phat, crit.val = crit)
  }

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