comvar2:

Usage Arguments Examples

Usage

1
comvar2(x, y, nboot = 1000, SEED = TRUE)

Arguments

x
y
nboot
SEED

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
##---- 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 = 1000, SEED = TRUE) 
{
    x <- x[!is.na(x)]
    y <- y[!is.na(y)]
    sig <- var(x) - var(y)
    if (SEED) 
        set.seed(2)
    nmin <- min(length(x), length(y))
    print("Taking bootstrap samples. Please wait.")
    datax <- matrix(sample(x, size = nmin * nboot, replace = TRUE), 
        nrow = nboot)
    datay <- matrix(sample(y, size = nmin * nboot, replace = TRUE), 
        nrow = nboot)
    v1 <- apply(datax, 1, FUN = var)
    v2 <- apply(datay, 1, FUN = var)
    boot <- v1 - v2
    boot <- sort(boot)
    ilow <- 15
    ihi <- 584
    if (nmin < 250) {
        ilow <- 13
        ihi <- 586
    }
    if (nmin < 180) {
        ilow <- 10
        ihi <- 589
    }
    if (nmin < 80) {
        ilow <- 7
        ihi <- 592
    }
    if (nmin < 40) {
        ilow <- 6
        ihi <- 593
    }
    ilow <- round((ilow/599) * nboot)
    ihi <- round((ihi/599) * nboot)
    ci <- c(boot[ilow + 1], boot[ihi])
    list(ci = ci, vardif = sig)
  }

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