anctgen:

Usage Arguments Examples

Usage

1
anctgen(x1, y1, x2, y2, pts, fr1 = 1, fr2 = 1, tr = 0.2)

Arguments

x1
y1
x2
y2
pts
fr1
fr2
tr

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
##---- 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 (x1, y1, x2, y2, pts, fr1 = 1, fr2 = 1, tr = 0.2) 
{
    if (length(pts) >= 29) 
        stop("At most 28 points can be compared")
    n1 <- 1
    n2 <- 1
    vecn <- 1
    for (i in 1:length(pts)) {
        n1[i] <- length(y1[near(x1, pts[i], fr1)])
        n2[i] <- length(y2[near(x2, pts[i], fr2)])
    }
    mat <- matrix(NA, length(pts), 8)
    dimnames(mat) <- list(NULL, c("X", "n1", "n2", "DIF", "TEST", 
        "se", "ci.low", "ci.hi"))
    for (i in 1:length(pts)) {
        g1 <- y1[near(x1, pts[i], fr1)]
        g2 <- y2[near(x2, pts[i], fr2)]
        g1 <- g1[!is.na(g1)]
        g2 <- g2[!is.na(g2)]
        test <- yuen(g1, g2, tr = tr)
        mat[i, 1] <- pts[i]
        mat[i, 2] <- length(g1)
        mat[i, 3] <- length(g2)
        mat[i, 4] <- test$dif
        mat[i, 5] <- test$teststat
        mat[i, 6] <- test$se
        if (length(pts) >= 2) 
            critv <- smmcrit(test$df, length(pts))
        if (length(pts) == 1) 
            critv <- qt(0.975, test$df)
        cilow <- test$dif - critv * test$se
        cihi <- test$dif + critv * test$se
        mat[i, 7] <- cilow
        mat[i, 8] <- cihi
    }
    list(output = mat, crit = critv)
  }

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