trimpb:

Usage Arguments Examples

Usage

1
trimpb(x, tr = 0.2, alpha = 0.05, nboot = 2000, WIN = FALSE, win = 0.1, plotit = FALSE, pop = 1, null.value = 0, pr = TRUE, xlab = "X", fr = NA, SEED = TRUE)

Arguments

x
tr
alpha
nboot
WIN
win
plotit
pop
null.value
pr
xlab
fr
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
46
47
48
49
50
##---- 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, tr = 0.2, alpha = 0.05, nboot = 2000, WIN = FALSE, 
    win = 0.1, plotit = FALSE, pop = 1, null.value = 0, pr = TRUE, 
    xlab = "X", fr = NA, SEED = TRUE) 
{
    if (pr) {
        print("The p-value returned by this function is based on the")
        print("null value specified by the argument null.value, which defaults to 0")
    }
    x <- x[!is.na(x)]
    if (WIN) {
        if (win > tr) 
            stop("The amount of Winsorizing must be <= to the amount of trimming")
        x <- winval(x, win)
    }
    crit <- alpha/2
    icl <- round(crit * nboot) + 1
    icu <- nboot - icl
    bvec <- NA
    if (SEED) 
        set.seed(2)
    data <- matrix(sample(x, size = length(x) * nboot, replace = TRUE), 
        nrow = nboot)
    bvec <- apply(data, 1, mean, tr)
    bvec <- sort(bvec)
    p.value <- mean(bvec < null.value) + 0.5 * mean(bvec == null.value)
    p.value <- 2 * min(p.value, 1 - p.value)
    ci <- NA
    ci[1] <- bvec[icl]
    ci[2] <- bvec[icu]
    if (plotit) {
        if (pop == 1) 
            rdplot(as.vector(bvec), fr = fr, xlab = xlab)
        if (pop == 2) 
            kdplot(as.vector(bvec), rval = rval)
        if (pop == 3) 
            boxplot(as.vector(bvec))
        if (pop == 4) 
            stem(as.vector(bvec))
        if (pop == 5) 
            hist(as.vector(bvec))
        if (pop == 6) 
            akerd(as.vector(bvec), xlab = xlab)
    }
    list(ci = ci, p.value = p.value)
  }

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