difQpci:

Usage Arguments Examples

Usage

1
difQpci(x, y = NULL, q = seq(5, 40, 5)/100, xlab = "Quantile", ylab = "Group 1 minus Group 2", plotit = TRUE, alpha = 0.05, nboot = 1000, SEED = TRUE, LINE = FALSE)

Arguments

x
y
q
xlab
ylab
plotit
alpha
nboot
SEED
LINE

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
##---- 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 = NULL, q = seq(5, 40, 5)/100, xlab = "Quantile", 
    ylab = "Group 1 minus Group 2", plotit = TRUE, alpha = 0.05, 
    nboot = 1000, SEED = TRUE, LINE = FALSE) 
{
    x = as.matrix(x)
    if (is.null(y)) 
        dif = x
    if (ncol(x) > 2) 
        stop("Should be at most two groups")
    if (ncol(x) == 2) 
        dif = x[, 1] - x[, 2]
    if (!is.null(y)) 
        dif = x - y
    dif = elimna(dif)
    nv = length(dif)
    output = matrix(NA, ncol = 8, nrow = length(q))
    dimnames(output) = list(NULL, c("quantile", "Est_q", "Est_1.minus.q", 
        "SUM", "ci.low", "ci.up", "p_crit", "p-value"))
    for (i in 1:length(q)) {
        test = Dqdif(dif, q = q[i], plotit = FALSE, nboot = nboot, 
            SEED = SEED)
        output[i, 1] = q[i]
        output[i, 2] = test$est.q
        output[i, 3] = test$est.1.minus.q
        output[i, 8] = test$p.value
        output[i, 5] = test$conf.interval[1]
        output[i, 6] = test$conf.interval[2]
    }
    temp = order(output[, 8], decreasing = TRUE)
    zvec = alpha/c(1:length(q))
    output[temp, 7] = zvec
    output <- data.frame(output)
    output$signif = rep("YES", nrow(output))
    for (i in 1:nrow(output)) {
        if (output[temp[i], 8] > output[temp[i], 7]) 
            output$signif[temp[i]] = "NO"
        if (output[temp[i], 8] <= output[temp[i], 7]) 
            break
    }
    output[, 4] = output[, 2] + output[, 3]
    if (plotit) {
        plot(rep(q, 3), c(output[, 4], output[, 5], output[, 
            6]), type = "n", xlab = xlab, ylab = ylab)
        points(q, output[, 6], pch = "+")
        points(q, output[, 5], pch = "+")
        points(q, output[, 4], pch = "*")
        if (LINE) 
            lines(q, output[, 4], pch = "*")
    }
    list(n = nv, output = output)
  }

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