oddsratio: Odds Ratio

View source: R/ci_oddsratio.R

oddsratioR Documentation

Odds Ratio

Description

This function calculates the odds ratio of a 2x2 table/matrix, or a data frame with two columns.

Usage

oddsratio(x)

Arguments

x

A 2x2 matrix/table of counts, or a data.frame with exactly two columns representing the two binary variables.

Details

The numerator equals the ratio of the top left entry and the bottom left entry of the 2x2 table, while the denominator equals the ratio of the top right entry and the bottom right entry. The result is usually slightly different from the one of stats::fisher.test(), which is based on the ML estimate of the odds ratio.

Value

A numeric vector of length one.

See Also

ci_oddsratio()

Examples

tab <- cbind(c(10, 5), c(4, 4))
oddsratio(tab)

confintr documentation built on June 7, 2023, 6:24 p.m.