wlogregci:

Usage Arguments Examples

Usage

1
wlogregci(x, y, nboot = 400, alpha = 0.05, SEED = TRUE, MC = FALSE, xlab = "Predictor 1", ylab = "Predictor 2", xout = FALSE, outfun = out, ...)

Arguments

x
y
nboot
alpha
SEED
MC
xlab
ylab
xout
outfun
...

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
##---- 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 = 400, alpha = 0.05, SEED = TRUE, MC = FALSE, 
    xlab = "Predictor 1", ylab = "Predictor 2", xout = FALSE, 
    outfun = out, ...) 
{
    if (MC) 
        library(parallel)
    x <- as.matrix(x)
    p1 <- ncol(x) + 1
    p <- ncol(x)
    xy <- cbind(x, y)
    xy <- elimna(xy)
    x <- xy[, 1:p]
    y <- xy[, p1]
    if (xout) {
        m <- cbind(x, y)
        flag <- outfun(x, plotit = FALSE)$keep
        m <- m[flag, ]
        x <- m[, 1:p]
        y <- m[, p1]
    }
    if (SEED) 
        set.seed(2)
    n = length(y)
    data <- matrix(sample(n, size = length(y) * nboot, replace = TRUE), 
        nrow = n, ncol = nboot)
    data = listm(data)
    data <- matrix(sample(n, size = length(y) * nboot, replace = TRUE), 
        nrow = n, ncol = nboot)
    n = length(y)
    data <- matrix(sample(n, size = length(y) * nboot, replace = TRUE), 
        nrow = n, ncol = nboot)
    data = listm(data)
    if (MC) 
        bvec <- mclapply(data, wlogreg.sub, x, y, mc.preschedule = TRUE)
    if (!MC) 
        bvec <- lapply(data, wlogreg.sub, x, y)
    bvec = matl(bvec)
    x = as.matrix(x)
    p1 <- ncol(x) + 1
    regci <- matrix(0, p1, 3)
    VAL <- c("intercept", rep("X", ncol(x)))
    dimnames(regci) <- list(VAL, c("Est.", "ci.low", "ci.up"))
    se <- NA
    sig.level <- NA
    for (i in 1:p1) {
        bna = elimna(bvec[i, ])
        nbn = length(bna)
        ilow <- round((alpha/2) * nbn)
        ihi <- nbn - ilow
        ilow <- ilow + 1
        temp <- mean(bna < 0)
        sig.level[i] <- 2 * (min(temp, 1 - temp))
        bna <- sort(bna)
        regci[i, 2] <- bna[ilow]
        regci[i, 3] <- bna[ihi]
        se[i] <- sqrt(var(elimna(bvec[i, ])))
    }
    regci[, 1] = wlogreg(x, y)$coef
    list(conf.interval = regci, p.values = sig.level, se = se)
  }

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