Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

oddsratio

Compute odds ratio (OR)


Description

Returns the odds in each group, and the odds ratio. Takes the cases (n) and total N as a list of two numbers for each of two groups.

Usage

oddsratio(grp1 = c(n = 3, N = 10), grp2 = c(n = 1, N = 10), alpha = 0.05)

Arguments

grp1

either odds for group 1, or cases and total N , e.g c(n=3, N=10)

grp2

either odds for group 2, or cases and total N , e.g c(n=1, N=20)

alpha

for CI (default = 0.05)

Details

Returns a list of odds1, odds2, and OR + CI. Has a pretty-printing method so displays as:

Group 1 odds = 0.43
Group 2 odds = 0.11
          OR = 3.86 CI95[0.160, 3.64]

Value

  • List of odds in group 1 and group2, and the resulting OR and CI

References

See Also

Examples

oddsratio(grp1 = c(1, 10), grp2 = c(3, 10))
oddsratio(grp1 = 0.111, grp2 = 0.429)
oddsratio(grp1 = c(3, 10), grp2 = c(1, 10))
oddsratio(grp1 = c(3, 10), grp2 = c(1, 10), alpha = .01)

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.