1 |
x |
|
y |
|
alpha |
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.