shiftdhd:

Usage Arguments Examples

Usage

1
shiftdhd(x, y, nboot = 200, plotit = TRUE, plotop = FALSE, SEED = TRUE, pr = TRUE)

Arguments

x
y
nboot
plotit
plotop
SEED
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
##---- 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, y, nboot = 200, plotit = TRUE, plotop = FALSE, SEED = TRUE, 
    pr = TRUE) 
{
    if (pr) {
        print("NOTE:  if the goal is to use an alpha value different from .05")
        print("use the function qcomdhd or  qdec2ci")
    }
    xy = elimna(cbind(x, y))
    x = xy[, 1]
    y = xy[, 2]
    plotit <- as.logical(plotit)
    if (SEED) 
        set.seed(2)
    crit <- 37/length(x)^(1.4) + 2.75
    if (pr) 
        print("The approximate .05 critical value is")
    if (pr) 
        print(crit)
    m <- matrix(0, 9, 6)
    if (pr) 
        print("Taking Bootstrap Samples. Please wait.")
    data <- matrix(sample(length(x), size = length(x) * nboot, 
        replace = TRUE), nrow = nboot)
    xmat <- matrix(x[data], nrow = nboot, ncol = length(x))
    ymat <- matrix(y[data], nrow = nboot, ncol = length(x))
    for (i in 1:9) {
        q <- i/10
        bvec <- apply(xmat, 1, hd, q) - apply(ymat, 1, hd, q)
        se <- sqrt(var(bvec))
        dif <- hd(x, q) - hd(y, q)
        m[i, 1] = hd(x, q)
        m[i, 2] = hd(y, q)
        m[i, 3] <- dif
        m[i, 4] <- dif - crit * se
        m[i, 5] <- dif + crit * se
        m[i, 6] <- se
    }
    dimnames(m) <- list(NULL, c("est.1", "est.2", "est.dif", 
        "ci.lower", "ci.upper", "se"))
    if (plotit) {
        if (plotop) {
            xaxis <- c(1:9)/10
            xaxis <- c(xaxis, xaxis)
        }
        if (!plotop) 
            xaxis <- c(deciles(x), deciles(x))
        par(pch = "+")
        yaxis <- c(m[, 1], m[, 2])
        if (!plotop) 
            plot(xaxis, yaxis, ylab = "delta", xlab = "x (first group)")
        if (plotop) 
            plot(xaxis, yaxis, ylab = "delta", xlab = "Deciles")
        par(pch = "*")
        if (!plotop) 
            points(deciles(x), m[, 3])
        if (plotop) 
            points(c(1:9)/10, m[, 3])
    }
    m
  }

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