o_to_p: Convert odds to probability.

Description Usage Arguments Details Value See Also Examples

View source: R/prob-odds.R

Description

o_to_p() converts decimal or ratio odds to probability.

Usage

1
o_to_p(odds, print = FALSE)

Arguments

odds

A single odds, either in the format of character ratio odds (e.g., "3:1") or numeric decimal odds (e.g., 0.5 or 9).

print

A logical indicating whether to print a sentence description of the calculated odds for the given probaiblity.

Details

If print = TRUE, an explanatory sentence will be printed in the form "If the odds of an event occuring are <odds>, the probability is <decimal probability>."

Value

The output will be a decimal probability. If print = TRUE, the decimal probability will be returned invisibly.

See Also

p_to_o for converting probability to odds.

Examples

1
2
3
4
o_to_p("9:1")
o_to_p("3:1", print = TRUE)
calculated_prob <- o_to_p(0.5, print = TRUE)
calculated_prob

ricompute/llusmstats documentation built on May 24, 2019, 6:18 a.m.