build_chairs | R Documentation |
build_chairs()
calculates the odds ratio [OR] and standard error of the log(odds ratio)
or SE(log(OR)) for each factor.
build_chairs(timber, log_base = exp(1))
timber |
a tibble of timber, with a table built by |
log_base |
numeric: the logarithm base used in the calculation of the SE(log(OR)) from CIs. |
The odds ratio and the standard error of the log(odds ratio) can be calculated using a complete contingency table, or using the odds ratio and the confidence intervals (CIs).
The formula to calculate the odds ratio from a contingency table is:
OR = (A/B) / (C/D)
The formula to calculate the standard error of the log(odds ratio) from a contingency table is:
SE(log(OR)) = sqrt((1/A) + (1/B) + (1/C) + (1/D))
The formula to calculate the standard error of the log(odds ratio) from the CIs is:
SE(log(OR)) = (log(oddsup) - log(oddslo)) / (2 * Z)
where Z is the Z value corresponding to 1/2 alpha, and alpha = 1 - confidence level.
Note, the the choice of logarithm base for this calculation may be specified by the user as
log_base
(default = e or Euler's number).
A tibble of timber with additional columns: odds_ratio and se_log_or.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.