acbinomci:

Usage Arguments Examples

Usage

1
acbinomci(x = sum(y), nn = length(y), y = NULL, n = NA, alpha = 0.05)

Arguments

x
nn
y
n
alpha

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 = sum(y), nn = length(y), y = NULL, n = NA, alpha = 0.05) 
{
    if (!is.null(y[1])) {
        y = elimna(y)
        nn = length(y)
    }
    if (nn == 1) 
        stop("Something is wrong: number of observations is only 1")
    n <- nn
    if (x != n && x != 0) {
        cr = qnorm(1 - alpha/2)
        ntil = n + cr^2
        ptil = (x + cr^2/2)/ntil
        lower = ptil - cr * sqrt(ptil * (1 - ptil)/ntil)
        upper = ptil + cr * sqrt(ptil * (1 - ptil)/ntil)
    }
    if (x == 0) {
        lower <- 0
        upper <- 1 - alpha^(1/n)
    }
    if (x == 1) {
        upper <- 1 - (alpha/2)^(1/n)
        lower <- 1 - (1 - alpha/2)^(1/n)
    }
    if (x == n - 1) {
        lower <- (alpha/2)^(1/n)
        upper <- (1 - alpha/2)^(1/n)
    }
    if (x == n) {
        lower <- alpha^(1/n)
        upper <- 1
    }
    phat <- x/n
    list(phat = phat, ci = c(lower, upper))
  }

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