**Prob and Stats**

# Comprehensive guide on odds and odds ratio in statistics and probability

*schedule*Mar 5, 2023

*toc*Table of Contents

*expand_more*

**interactive map of data science**

# What are odds?

Odds are defined by the probability that an event will occur divided by the probability that an event will not occur:

Odds are related to the concept of probability, but are expressed differently. As we shall demonstrate later, we can easily interchange between odds and probability.

# Example of calculating odds when tossing a coin

Suppose we flipped a fair coin. The odds of getting a heads are:

Here, note the following:

we can write this as $1:1$ (one to one) odds of getting a heads

we can interpret this as the probability of getting a heads is equal to the probability of getting a tails

another interpretation is that for every 2 flips, we should expect one heads and one tails

if we get an odds value equal to $1$, this implies that the probability that the event will occur is $50\%$.

# Example of calculating odds when rolling a die

Suppose we rolled a fair die. The odds of getting a 5 or 6 are:

Note the following:

we can write this as $1:2$ (one to two) odds of rolling a 5 or 6.

we can interpret this as the probability of flipping a 5 or 6 is half of flipping a 1, 2, 3 or 4.

another interpretation is that for every 3 rolls, we should expect 1 success (5 or 6) and 2 failures (1,2,3 or 4).

if we get an odds value less than 1, this implies that the probability of the event occurring is less than $50\%$.

# Converting between probability and odds

## Converting from probability to odds

Suppose event $A$ occurs at a probability of $0.8$:

To convert this into odds:

The odds of event $A$ occurring are therefore 4.

## Converting from odds to probability

Recall that odds can be computed using the following formula:

Let's make the probability $p$ the subject:

We can use formula \eqref{eq:yT4xGW15AAuwtV9Ph1H} to convert from odds to probability.

As an example, suppose the odds of an event $A$ occurring is $4$:

To convert this to probability, we use formula \eqref{eq:yT4xGW15AAuwtV9Ph1H}:

Therefore, event $A$ occurs at a probability of $0.8$.

# Plotting relationship between odds and probability

Using formula \eqref{eq:yT4xGW15AAuwtV9Ph1H}, we can plot the relationship between probability and odds:

As you would expect, the probability is bounded between 0 and 1, whereas odds can take on any positive value.

# What are odds ratio?

Odds ratio is a ratio of two odds. For instance, suppose we have an unfair coin where heads occur with a probability of $0.8$. The odds of obtaining a heads with this unfair coin are as follows:

Let's compare this with the odds of getting a heads for a fair coin:

We can now compute the odd ratio between these two events:

The odds of getting heads using the unfair coin are 4 times greater than that of a fair coin. In other words, you're 4 times more likely to get a heads with the unfair coin.

# Application in logistic regression

The concept of odds and odds ratio is important when performing inferences for logistic regression, which is a binary classifier that can be trained to predict whether an event will occur or not. Please check out our comprehensive guide on logistic regression to learn about how odds and odds ratio play a role in inference.