adtestv2:

Usage Arguments Examples

Usage

1
adtestv2(x, y, est = tmean, nboot = 500, alpha = 0.05, fr = NA, xout = TRUE, outfun = outpro, com.pval = FALSE, SEED = TRUE, qval = 0.5, ...)

Arguments

x
y
est
nboot
alpha
fr
xout
outfun
com.pval
SEED
qval
...

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
##---- 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, est = tmean, nboot = 500, alpha = 0.05, fr = NA, 
    xout = TRUE, outfun = outpro, com.pval = FALSE, SEED = TRUE, 
    qval = 0.5, ...) 
{
    if (ncol(x) != 2) 
        stop("There should be two predictors")
    temp <- cbind(x, y)
    p <- ncol(x)
    p1 <- p + 1
    temp <- elimna(temp)
    x <- temp[, 1:p]
    x <- as.matrix(x)
    y <- temp[, p1]
    if (xout) {
        keepit <- rep(T, nrow(x))
        flag <- outfun(x, plotit = FALSE, ...)$out.id
        keepit[flag] <- FALSE
        x <- x[keepit, ]
        y <- y[keepit]
    }
    if (alpha < 0.05 && nboot <= 100) 
        warning("You used alpha<.05 and nboot<=100")
    if (is.na(fr)) {
        fr <- 0.8
        if (ncol(x) == 2) {
            nval <- c(20, 30, 50, 80, 100, 200, 300, 400)
            fval <- c(0.4, 0.36, 0.3, 0.25, 0.23, 0.12, 0.08, 
                0.015)
            if (length(y) <= 400) 
                fr <- approx(nval, fval, length(y))$y
            if (length(y) > 400) 
                fr <- 0.01
        }
    }
    if (SEED) 
        set.seed(2)
    x <- as.matrix(x)
    mflag <- matrix(NA, nrow = length(y), ncol = length(y))
    for (j in 1:length(y)) {
        for (k in 1:length(y)) {
            mflag[j, k] <- (sum(x[j, ] <= x[k, ]) == ncol(x))
        }
    }
    yhat <- adrun(x, y, est = est, plotit = FALSE, fr = fr, pyhat = T)
    regres <- y - yhat
    test2 = medind(regres, x[, 1] * x[, 2], qval = qval, nboot = nboot, 
        com.pval = com.pval, SEED = SEED, alpha = alpha, pr = TRUE, 
        xout = xout, outfun = outfun, ...)
    test2
  }

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