twodcor10:

Usage Arguments Examples

Usage

1
twodcor10(x, y, nboot = 500, SEED = TRUE, alpha = 0.05)

Arguments

x
y
nboot
SEED
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
##---- 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, nboot = 500, SEED = TRUE, alpha = 0.05) 
{
    if (SEED) 
        set.seed(2)
    X <- elimna(cbind(x, y))
    if (ncol(X) != 3) 
        stop("x should be a matrix with  two columns")
    n <- nrow(X)
    cval <- cor(X)
    nval <- (cval[1, 3] + cval[2, 3])/2
    cmat <- bdiag(1, 3, nval)
    cmat[1, 2] <- nval
    cmat[2, 1] <- nval
    pval <- NA
    for (i in 1:nboot) {
        d <- rmul(n, p = 3, cmat = cmat)
        pval[i] <- twodcor8(d[, 1:2], d[, 3])$p.value
    }
    pval <- sort(pval)
    iv <- round(alpha * nboot)
    est.p <- pval[iv]
    adp <- alpha/est.p
    test <- twodcor8(X[, 1:2], X[, 3])$p.value
    p.value <- test * adp
    if (p.value > 1) 
        p.value <- 1
    list(p.value = p.value)
  }

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