Learn R Programming

mStats (version 3.2.2)

tabOdds: Calculating Odds

Description

tabOdds generates cross-tabulation between two variables and display odds of failure var_case among exposure variable var_exp. It is used in case-control studies.

Usage

tabOdds(
  data,
  ...,
  by,
  exp_value = NULL,
  case_value = NULL,
  plot = TRUE,
  na.rm = FALSE,
  rnd = 3
)

Arguments

data

Dataset

...

Variable or multiple variables Colon separator : can be used to specify multiple variables.

by

Varaiable for cross-tabulation

exp_value

value for exposure as reference

case_value

value for outcome as reference

plot

logical value to display plots of rates across a categorical variable

na.rm

A logical value to specify missing values, NA in the table

rnd

specify rounding of numbers. See round.

Details

A table tabulating odds and corresponding 95\ is generated.

Formula for calculating Odds

$$OR = d1 x h0 / d0 x h1$$

Error Factor (EF)

$$EF = exp(1.96 x SE(log odds))$$

$$SE(log odds) = \sqrt{1/d + 1/h}$$

References

  1. Betty R. Kirkwood, Jonathan A.C. Sterne (2006, ISBN:978<U+2013>0<U+2013>86542<U+2013>871<U+2013>3)

  2. B. Burt Gerstman (2013, ISBN:978-1-4443-3608-5)

  3. Douglas G Altman (2005, ISBN:0 7279 1375 1)

Examples

Run this code
# NOT RUN {
## use infert data
data(infert)

tabOdds(infert, education, by = case, plot = FALSE)

# }

Run the code above in your browser using DataLab