oddsratioWald.proc <- function(n00, n01, n10, n11, alpha = 0.05){
#
# Compute the odds ratio between two binary variables, x and y,
# as defined by the four numbers nij:
#
# n00 = number of cases where x = 0 and y = 0
# n01 = number of cases where x = 0 and y = 1
# n10 = number of cases where x = 1 and y = 0
# n11 = number of cases where x = 1 and y = 1
#
OR <- (n00 * n11)/(n01 * n10)
#
# Compute the Wald confidence intervals:
#
siglog <- sqrt((1/n00) + (1/n01) + (1/n10) + (1/n11))
zalph <- qnorm(1 - alpha/2)
logOR <- log(OR)
loglo <- logOR - zalph * siglog
loghi <- logOR + zalph * siglog
#
ORlo <- exp(loglo)
ORhi <- exp(loghi)
#
oframe <- data.frame(LowerCI = ORlo, OR = OR, UpperCI = ORhi, alpha = alpha)
oframe
}