ODDSR.CI:

Usage Arguments Examples

Usage

1
ODDSR.CI(x, y = NULL, alpha = 0.05)

Arguments

x
y
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
##---- 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, y = NULL, alpha = 0.05) 
{
    if (is.matrix(x)) {
        if (ncol(x) != 2) 
            stop("If x is a matrix, should have 2 columns")
        if (nrow(x) != 2) 
            stop("If x is a matrix, should have 2 rows")
        n = sum(x)
        x1 = rep(1, x[1, 1])
        y1 = rep(1, x[1, 1])
        x2 = rep(0, x[1, 2])
        y2 = rep(1, x[1, 2])
        x3 = rep(1, x[2, 1])
        y3 = rep(0, x[2, 1])
        x4 = rep(0, x[2, 2])
        y4 = rep(0, x[2, 2])
        x = c(x1, x2, x3, x4)
        y = c(y1, y2, y3, y4)
    }
    temp = logreg(x, y)
    z = qnorm(1 - alpha/2)
    ci = c(exp(temp[2, 1] - z * temp[2, 2]), exp(temp[2, 1] + 
        z * temp[2, 2]))
    list(odds.ratio = exp(temp[2, 1]), ci = ci)
  }

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