sm2str:

Usage Arguments Examples

Usage

1
sm2str(xx, y, iv = c(1, 2), nboot = 100, SEED = TRUE, xout = FALSE, outfun = outpro, STAND = TRUE, ...)

Arguments

xx
y
iv
nboot
SEED
xout
outfun
STAND
...

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
##---- 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 (xx, y, iv = c(1, 2), nboot = 100, SEED = TRUE, xout = FALSE, 
    outfun = outpro, STAND = TRUE, ...) 
{
    if (!is.matrix(xx)) 
        stop("x should be a matrix with 2 or more columns")
    if (ncol(xx) < 2) 
        stop("x should be a matrix with 2 or more columns")
    val1 = NA
    val2 = NA
    x = xx[, iv]
    xy = elimna(cbind(x, y))
    x = xy[, 1:2]
    y = xy[, 3]
    if (xout) {
        x <- as.matrix(x)
        flag <- outfun(x, ...)$keep
        x <- x[flag, ]
        y <- y[flag]
        x <- as.matrix(x)
    }
    if (SEED) 
        set.seed(2)
    data1 <- matrix(sample(length(y), size = length(y) * nboot, 
        replace = TRUE), nrow = nboot)
    data2 <- matrix(sample(length(y), size = length(y) * nboot, 
        replace = TRUE), nrow = nboot)
    bvec1 = apply(data1, 1, sm2str.sub, x[, 1], y)
    bvec2 = apply(data2, 1, sm2str.sub, x[, 2], y)
    bvecd = bvec1 - bvec2
    pv = akerdcdf(bvecd, pts = 0)
    vcor = cor(x, method = "kendall")
    pv = 2 * min(c(pv, 1 - pv))
    p.crit = 0.25 * abs(vcor[1, 2]) + 0.05 + (100 - length(y))/10000
    p.crit = max(c(0.05, p.crit))
    list(p.value = pv, p.crit = p.crit)
  }

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