ancsm:

Usage Arguments Examples

Usage

1
ancsm(x1, y1, x2, y2, crit.mat = NULL, nboot = 200, SEED = TRUE, REP.CRIT = FALSE, LP = TRUE, est = tmean, fr = NULL, plotit = TRUE, sm = FALSE, xout = FALSE, outfun = out, xlab = "X", ylab = "Y", ...)

Arguments

x1
y1
x2
y2
crit.mat
nboot
SEED
REP.CRIT
LP
est
fr
plotit
sm
xout
outfun
xlab
ylab
...

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
##---- 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, crit.mat = NULL, nboot = 200, SEED = TRUE, 
    REP.CRIT = FALSE, LP = TRUE, est = tmean, fr = NULL, plotit = TRUE, 
    sm = FALSE, xout = FALSE, outfun = out, xlab = "X", ylab = "Y", 
    ...) 
{
    if (ncol(as.matrix(x1)) > 1) 
        stop("One covariate only is allowed")
    if (xout) {
        flag1 = outfun(x1, ...)$keep
        flag2 = outfun(x2, ...)$keep
        x1 = x1[flag1]
        y1 = y1[flag1]
        x2 = x2[flag2]
        y2 = y2[flag2]
    }
    xy = elimna(cbind(x1, y1))
    x1 = xy[, 1]
    xord = order(x1)
    x1 = x1[xord]
    y1 = xy[xord, 2]
    xy = elimna(cbind(x2, y2))
    x2 = xy[, 1]
    xord = order(x2)
    x2 = x2[xord]
    y2 = xy[xord, 2]
    n1 = length(y1)
    n2 = length(y2)
    if (is.null(fr)) {
        fr = 1
        if (min(n1, n2) > 150) 
            fr = 0.2
        if (max(n1, n2) < 35) 
            fr = 0.5
    }
    if (SEED) 
        set.seed(2)
    if (is.null(crit.mat[1])) {
        crit.val = NA
        yall = c(y1, y2)
        xall = c(x1, x2)
        nn = n1 + n2
        il = n1 + 1
        for (i in 1:nboot) {
            data = sample(nn, nn, TRUE)
            yy1 = yall[data[1:n1]]
            yy2 = yall[data[il:nn]]
            xx1 = xall[data[1:n1]]
            xx2 = xall[data[il:nn]]
            crit.mat[i] = depthcom(xx1, yy1, xx2, yy2, est = est, 
                fr = fr)
        }
    }
    if (plotit) 
        runmean2g(x1, y1, x2, y2, fr = fr, est = est, sm = sm, 
            xlab = xlab, ylab = ylab, LP = LP, ...)
    dep = depthcom(x1, y1, x2, y2, est = est, fr = fr)
    n = min(n1, n2)
    pv = 1 - mean(crit.mat < dep)
    if (!REP.CRIT) 
        crit.mat = NULL
    list(p.value = pv, crit.mat = crit.mat, test.depth = dep)
  }

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