Learn R Programming

swfscMisc (version 1.1)

odds: Odds Conversion

Description

odds
converts probability to odds
logOdds
converts odds to log-odds
invOdds
converts odds to probability
invLogOdds
converts log-odds to odds

Usage

odds(x)
logOdds(x)
invOdds(x)
invLogOdds(x)

Arguments

x
a numeric vector of probabilities (0 to 1), odds (0 to Inf), or log.odds (-Inf to Inf).

Examples

Run this code
x <- sort(runif(10))
odds.df <- data.frame(x = x, odds = odds(x), logOdds = logOdds(x))
odds.df
invOdds(odds.df$odds)
invLogOdds(odds.df$logOdds)

Run the code above in your browser using DataLab