Dancovapts:

Usage Arguments Examples

Usage

1
Dancovapts(x1, y1, x2, y2, fr1 = 1, fr2 = 1, tr = 0.2, alpha = 0.05, plotit = TRUE, pts = NA, sm = FALSE, xout = FALSE, outfun = out, DIF = FALSE, LP = TRUE, ...)

Arguments

x1
y1
x2
y2
fr1
fr2
tr
alpha
plotit
pts
sm
xout
outfun
DIF
LP
...

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
##---- 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 (x1, y1, x2, y2, fr1 = 1, fr2 = 1, tr = 0.2, alpha = 0.05, 
    plotit = TRUE, pts = NA, sm = FALSE, xout = FALSE, outfun = out, 
    DIF = FALSE, LP = TRUE, ...) 
{
    if (ncol(as.matrix(x1)) > 1) 
        stop("One covariate only is allowed with this function")
    if (length(x1) != length(y1)) 
        stop("x1 and y1 have different lengths")
    if (length(x1) != length(x2)) 
        stop("x1 and y2 have different lengths")
    if (length(x2) != length(y2)) 
        stop("x2 and y2 have different lengths")
    if (length(y1) != length(y2)) 
        stop("y1 and y2 have different lengths")
    xy = elimna(cbind(x1, y1, x2, y2))
    x1 = xy[, 1]
    y1 = xy[, 2]
    x2 = xy[, 3]
    y2 = xy[, 4]
    xorder <- order(x1)
    y1 <- y1[xorder]
    x1 <- x1[xorder]
    xorder <- order(x2)
    y2 <- y2[xorder]
    x2 <- x2[xorder]
    n = length(y1)
    npts = length(pts)
    mat <- matrix(NA, nrow = npts, nco = 9)
    dimnames(mat) <- list(NULL, c("X", "n", "DIF", "TEST", "se", 
        "ci.low", "ci.hi", "p.value", "p.crit"))
    for (i in 1:npts) {
        t1 = near(x1, pts[i], fr1)
        t2 = near(x2, pts[i], fr2)
        ivals = c(1:n)
        iv1 = ivals[t1]
        iv2 = ivals[t2]
        pick = unique(c(iv1, iv2))
        mat[i, 2] <- length(y1[pick])
        if (!DIF) 
            test <- yuend(y1[pick], y2[pick], tr = tr, alpha = alpha)
        if (DIF) 
            test <- trimci(y1[pick] - y2[pick], tr = tr, pr = FALSE, 
                alpha = alpha)
        mat[i, 1] <- pts[i]
        if (!DIF) {
            mat[i, 4] <- test$teststat
            mat[i, 3] <- test$dif
        }
        if (DIF) {
            mat[i, 4] <- test$test.stat
            mat[i, 3] <- test$estimate
        }
        mat[i, 5] <- test$se
        mat[i, 6] <- test$ci[1]
        mat[i, 7] <- test$ci[2]
        mat[i, 8] <- test$p.value
    }
    temp2 <- order(0 - mat[, 8])
    bot = c(1:nrow(mat))
    dvec = sort(alpha/bot, decreasing = TRUE)
    mat[temp2, 9] = dvec
    mat
  }

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