odds_ratios | R Documentation |
Calculates either local, cumulative, or global odds ratios for a given contingency table (best made with 'xtabs'). Follows the general form equation given in Agresti, 2010 pg 23. Can also support a table of probabilities rather than counts so long as 'n' is provided.
odds_ratios( table, type = "cumulative", n = NA, use_confint = TRUE, bonf = FALSE, reverse = FALSE )
table |
Contingency table, recommended to use 'xtabs' |
type |
String of which logit to return, either cumulative (default), local, or global |
n |
If using probabilities instead of counts, the total number of observations |
use_confint |
Logical, default TRUE, whether 95 should be calculated and reported in a table |
bonf |
Logical, default FALSE, whether to use Bonferroni correction on standard errors |
reverse |
Logical, default FALSE, whether to reverse the table to be descending rather than ascending. |
Note that the interpretation of the resulting 'odds_ratio' index changes depending on the ordering of the factors. 'xtabs' will use increasing order (highest X on the right) while Agresti's textbook uses decreasing order (highest X on the left). The signs of the estimates are the same regardless of the order, though. If you would like them to be reversed, use the 'reverse' argument.
95 and Bonferroni corrections to the standard errors are also supported.
data.frame with odds ratios, standard errors, and confidence intervals
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.