msmedsub:

Usage Arguments Examples

Usage

1
msmedsub(n, con = 0, alpha = 0.05, se.fun = bpmedse, iter = 1000, SEED = TRUE)

Arguments

n
con
alpha
se.fun
iter
SEED

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
##---- 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 (n, con = 0, alpha = 0.05, se.fun = bpmedse, iter = 1000, 
    SEED = TRUE) 
{
    if (SEED) 
        set.seed(2)
    con <- as.matrix(con)
    J <- length(n)
    h <- vector("numeric", J)
    w <- vector("numeric", J)
    xbar <- vector("numeric", J)
    x <- list()
    test <- NA
    testmax <- NA
    for (it in 1:iter) {
        for (j in 1:J) {
            x[[j]] <- rnorm(n[j])
            xbar[j] <- median(x[[j]])
            w[j] <- se.fun(x[[j]])^2
        }
        if (sum(con^2 != 0)) 
            CC <- ncol(con)
        if (sum(con^2) == 0) {
            CC <- (J^2 - J)/2
            jcom <- 0
            for (j in 1:J) {
                for (k in 1:J) {
                  if (j < k) {
                    jcom <- jcom + 1
                    test[jcom] <- abs(xbar[j] - xbar[k])/sqrt(w[j] + 
                      w[k])
                  }
                }
            }
        }
        if (sum(con^2) > 0) {
            for (d in 1:ncol(con)) {
                sejk <- sqrt(sum(con[, d]^2 * w))
                test[d] <- sum(con[, d] * xbar)/sejk
            }
        }
        testmax[it] <- max(abs(test))
    }
    testmax <- sort(testmax)
    testmax
  }

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