outbox:

Usage Arguments Examples

Usage

1
outbox(x, mbox = FALSE, gval = NA, plotit = FALSE, STAND = FALSE)

Arguments

x
mbox
gval
plotit
STAND

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
##---- 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, mbox = FALSE, gval = NA, plotit = FALSE, STAND = FALSE) 
{
    x <- x[!is.na(x)]
    if (plotit) 
        boxplot(x)
    n <- length(x)
    temp <- idealf(x)
    if (mbox) {
        if (is.na(gval)) 
            gval <- (17.63 * n - 23.64)/(7.74 * n - 3.71)
        cl <- median(x) - gval * (temp$qu - temp$ql)
        cu <- median(x) + gval * (temp$qu - temp$ql)
    }
    if (!mbox) {
        if (is.na(gval)) 
            gval <- 1.5
        cl <- temp$ql - gval * (temp$qu - temp$ql)
        cu <- temp$qu + gval * (temp$qu - temp$ql)
    }
    flag <- NA
    outid <- NA
    vec <- c(1:n)
    for (i in 1:n) {
        flag[i] <- (x[i] < cl || x[i] > cu)
    }
    if (sum(flag) == 0) 
        outid <- NULL
    if (sum(flag) > 0) 
        outid <- vec[flag]
    keep <- vec[!flag]
    outval <- x[flag]
    n.out = sum(length(outid))
    list(out.val = outval, out.id = outid, keep = keep, n = n, 
        n.out = n.out, cl = cl, cu = cu)
  }

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