oddsratio.estimation {epitools} | R Documentation |
Estimates odds ratio using different methods and performs Fisher's exact test for testing the null of independence of rows and columns in a contingency table with fixed marginals.
oddsratio.crude(...) oddsratio.fisher(...) oddsratio.ss(...)
... |
A 2x2 table or equivalent. See as.epitable
for details. |
These functions calculate the odds ratio using different methods and performs Fisher's exact test for testing the null of independence of rows and columns in a contingency table with fixed marginals. These functions calculate the odds ratio for the following type of 2x2 contingency table (opposite of how data is displayed in epidemiology textbooks, but consistent with how data is handled in statistical programs):
Outcome Exposure No Yes No (ref) a b Yes c d
The oddsratio.crude
function calculates the odds ratio using
the cross-product (a*d)/(b*c).
The oddsratio.fisher
function calculates the odds ratio using
the fisher.test
function. The odds ratio differs
slightly from the crude calculation.
The oddsratio.ss
function calculates the odds ratio using a
small sample (ss) adjustment (Jewell 2004): (a*d)/((b+1)*(c+1)).
$data |
original data |
$proportion.exposed |
proportion exposed for each outcome category |
$estimate |
odds ratio |
$fishers.exact |
p value |
Visit http://www.epitools.net for the latest.
Tomas Aragon, aragon@berkeley.edu, http://www.medepi.net/aragon
Nicholas P. Jewell (2004), Statistics for Epidemiology, Chapman & Hall, 1st Edition
See also riskratio.estimation
, as.epitable
, epitab
##From Jewell (2004), p. 79 oddsratio.crude(88, 20, 555, 347) oddsratio.fisher(88, 20, 555, 347) oddsratio.ss(88, 20, 555, 347) dat <- matrix(c(88, 20, 555, 347), 2, 2, byrow = TRUE) dimnames(dat) <- list (c("0", ">=1"), c("Controls", "Cases")) names(dimnames(dat)) <- c("Coffed drinking (cups/day)", "Pancreatic Cancer") dat oddsratio.crude(dat) oddsratio.fisher(dat) oddsratio.ss(dat)