p2or: Convert from a pair of probabilities to an odds ratio.

View source: R/Transform_Functions.R

p2orR Documentation

Convert from a pair of probabilities to an odds ratio.

Description

This function converts a pair of probability values into an odds ratio.

Usage

p2or(p0, p1)

Arguments

p0

A numeric value (or vector) for the probabilities of success in the reference group or category (i.e., the denominator for the odds ratio). NA values are acceptable, but will return NA. All numeric values must fall in the closed unit interval, [0, 1].

p1

A numeric value (or vector) for the probabilities of success in the focal group or category (i.e., the numerator for the odds ratio). NA values are acceptable, but will return NA. All numeric values must fall in the closed unit interval, [0, 1].

Details

=============================================================================

This function uses the formula OR = (p1/(1 - p1))/(p0/(1 - p0)).

Value

A numeric value (or vector) for the odds ratio values.

References

To be added later.

Examples

p2or(p0 = .3, p1 = .6)
p2or(p0 = c(.3, .4), p1 = c(.6, .5))


sjpierce/piercer documentation built on Dec. 30, 2024, 3:28 p.m.