permg:

Usage Arguments Examples

Usage

1
permg(x, y, alpha = 0.05, est = mean, nboot = 1000)

Arguments

x
y
alpha
est
nboot

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
##---- 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, alpha = 0.05, est = mean, nboot = 1000) 
{
    x <- x[!is.na(x)]
    y <- y[!is.na(y)]
    xx <- c(x, y)
    dif <- est(x) - est(y)
    vec <- c(1:length(xx))
    v1 <- length(x) + 1
    difb <- NA
    temp2 <- NA
    for (i in 1:nboot) {
        data <- sample(xx, size = length(xx), replace = FALSE)
        temp1 <- est(data[c(1:length(x))])
        temp2 <- est(data[c(v1:length(xx))])
        difb[i] <- temp1 - temp2
    }
    difb <- sort(difb)
    icl <- floor((alpha/2) * nboot + 0.5)
    icu <- floor((1 - alpha/2) * nboot + 0.5)
    reject <- "no"
    if (dif >= difb[icu] || dif <= difb[icl]) 
        reject <- "yes"
    list(dif = dif, lower = difb[icl], upper = difb[icu], reject = reject)
  }

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