Dqcomhd:

Usage Arguments Examples

Usage

1
Dqcomhd(x, y, q = c(1:9)/10, nboot = 1000, plotit = TRUE, SEED = TRUE, xlab = "Group 1", ylab = "Est.1-Est.2", na.rm = TRUE, alpha = 0.05)

Arguments

x
y
q
nboot
plotit
SEED
xlab
ylab
na.rm
alpha

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, q = c(1:9)/10, nboot = 1000, plotit = TRUE, SEED = TRUE, 
    xlab = "Group 1", ylab = "Est.1-Est.2", na.rm = TRUE, alpha = 0.05) 
{
    if (SEED) 
        set.seed(2)
    if (na.rm) {
        xy = elimna(cbind(x, y))
        x = xy[, 1]
        y = xy[, 2]
    }
    pv = NULL
    output = matrix(NA, nrow = length(q), ncol = 10)
    dimnames(output) <- list(NULL, c("q", "n1", "n2", "est.1", 
        "est.2", "est.1_minus_est.2", "ci.low", "ci.up", "p_crit", 
        "p-value"))
    for (i in 1:length(q)) {
        output[i, 1] = q[i]
        output[i, 2] = length(elimna(x))
        output[i, 3] = length(elimna(y))
        output[i, 4] = hd(x, q = q[i])
        output[i, 5] = hd(y, q = q[i])
        output[i, 6] = output[i, 4] - output[i, 5]
        if (na.rm) {
            temp = bootdpci(x, y, est = hd, q = q[i], dif = FALSE, 
                plotit = FALSE, pr = FALSE, nboot = nboot, alpha = alpha, 
                SEED = FALSE)
            output[i, 7] = temp$output[1, 5]
            output[i, 8] = temp$output[1, 6]
            output[i, 10] = temp$output[1, 3]
        }
        if (!na.rm) {
            temp = rmmismcp(x, y, est = hd, q = q[i], plotit = FALSE, 
                pr = FALSE, nboot = nboot, alpha = alpha, SEED = FALSE)
            output[i, 7] = temp$output[1, 6]
            output[i, 8] = temp$output[1, 7]
            output[i, 10] = temp$output[1, 4]
        }
    }
    if (plotit) {
        xax = rep(output[, 4], 3)
        yax = c(output[, 6], output[, 7], output[, 8])
        plot(xax, yax, xlab = xlab, ylab = ylab, type = "n")
        points(output[, 4], output[, 6], pch = "*")
        lines(output[, 4], output[, 6])
        points(output[, 4], output[, 7], pch = "+")
        points(output[, 4], output[, 8], pch = "+")
    }
    temp = order(output[, 10], decreasing = TRUE)
    zvec = alpha/c(1:length(q))
    output[temp, 9] = zvec
    output <- data.frame(output)
    output$signif = rep("YES", nrow(output))
    for (i in 1:nrow(output)) {
        if (output[temp[i], 10] > output[temp[i], 9]) 
            output$signif[temp[i]] = "NO"
        if (output[temp[i], 10] <= output[temp[i], 9]) 
            break
    }
    output
  }

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