powest:

Usage Arguments Examples

Usage

1
powest(x = NA, y = NA, delta = 0, se = NA, wv1 = NA, wv2 = NA, n1 = NA, n2 = NA)

Arguments

x
y
delta
se
wv1
wv2
n1
n2

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
##---- 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 = NA, y = NA, delta = 0, se = NA, wv1 = NA, wv2 = NA, 
    n1 = NA, n2 = NA) 
{
    tr <- 0.2
    if (is.na(se)) {
        if (is.na(wv1)) {
            h1 <- length(x) - 2 * floor(tr * length(x))
            h2 <- length(y) - 2 * floor(tr * length(y))
            q1 <- ((length(x) - 1) * winvar(x, tr))/(h1 * (h1 - 
                1))
            q2 <- ((length(y) - 1) * winvar(y, tr))/(h2 * (h2 - 
                1))
        }
        if (!is.na(wv1)) {
            if (is.na(n1)) 
                stop("Need to specify sample size for group 1")
            if (is.na(n2)) 
                stop("Need to specify sample size for group 2")
            h1 <- n1 - 2 * floor(tr * n1)
            h2 <- n2 - 2 * floor(tr * n2)
            q1 <- (n1 - 1) * wv1/(h1 * (h1 - 1))
            q2 <- (n2 - 1) * wv2/(h2 * (h2 - 1))
        }
        se <- sqrt(q1 + q2)
    }
    ygam <- sqrt(2 * 0.01155) * c(0:35)/8
    pow <- c(500, 540, 607, 706, 804, 981, 1176, 1402, 1681, 
        2008, 2353, 2769, 3191, 3646, 4124, 4617, 5101, 5630, 
        6117, 6602, 7058, 7459, 7812, 8150, 8479, 8743, 8984, 
        9168, 9332, 9490, 9607, 9700, 9782, 9839, 9868)/10000
    flag <- (delta == 0 && se == 0)
    if (flag) 
        powest <- 0.05
    else {
        chk <- floor(8 * delta/se) + 1
        chk1 <- chk + 1
        gval <- delta/se
        d1 <- (gval - (chk - 1)/8) * 8
        if (chk > length(pow)) 
            powest <- 1
        if (chk == length(pow)) 
            pow[chk1] <- 1
        if (chk <= length(pow)) 
            powest <- pow[chk] + d1 * (pow[chk1] - pow[chk])
    }
    powest
  }

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