Predictive Hacks

# Predict Basketball Games with Log5 formula

We have provided an example of how to get started with predictive models for NBA Games. In this post, we will show how you can get a rough estimate of the final outcome of the game by using the Log5 formula and the Beta Distribution. For this example, we will consider the game, Dallas Mavericks (away) vs Portland Trail Blazers (home).

## Predictions with the Log5 Formula

The Log5 formula returns the probability that Team A will win the game against Team B based on teams’ win rate. The Log5 formula is:

$$P_{A>B}=\frac{P_A-P_A \times P_B}{P_A+P_B-2 \times P_A \times P_B}$$

A few notable properties exist:

• If  PA=1, Log5 will always give A a 100% chance of victory.
• If PA=0, Log5 will always give A a 0% chance of victory.
• If PA=PB, Log5 will always return a 50% chance of victory for either team.
• If PA=0.5, Log5 will give A a 1-PB probability of victory.

In order to calculate the probabilities using the Log5 formula, we need to take into consideration the home and the away. A good approach is to take the following weights:

• 60% by taking into account the Home and Away Win Rate
• 30% by taking into account the Overall Win Rate
• 10% by taking into account the Last 10 Games Win Rate

Let’s get these Win Rates:

• Portland Home = 14-7 (66.6%); Dallas Away = 10-10 (50%)
• Portland Total = 25-21 (61%); Dallas Total = 21-19(52.5%)
• Portland Streak = 7-3 (70%); Dallas Streak = 6-4 (40%)

Now we are ready to calculate the Probability of Portland defeating Dallas

Por_Home=14/21
Dal_Away=10/20

Por_Total=25/41
Dal_Total=21/40

Por_Streak=7/10
Dal_Streak=6/10

log5<-function(home, away) {

prob<-(home-home*away)/(home+away-2*home*away)
prob
}

prob<-0.6*log5(Por_Home,Dal_Away) + 0.3*log5(Por_Total,Dal_Total) + 0.1*log5(Por_Streak,Dal_Streak)
prob


Output:

[1] 0.6365786

So, according to our logic the weighted Log5 the probability of Portland to Win the game is 63.65%.

### 2 thoughts on “Predict Basketball Games with Log5 formula”

1. Hello,

I believe Por_Total=25/45

• Hi Andre, these features are not static, they changed. That was the case when I wrote the article.

### Get updates and learn from the best

Python

#### How To Add Filters For Querying Databases In Streamlit

In this tutorial, we will show you how you can use filters for databases in Streamlit. We will use PostgresSQL

Python

#### How to Fine-Tune an NLP Regression Model with Transformers and HuggingFace

HuggingFace provides us with state-of-the-art pre-trained models that can be used in many different applications. In this post, we will