taylorbell.com

A First Prediction Formula

Let's jump right in and start working on a basic score prediction formula.

This formula is generic enough that it would probably work well for any sport, but I'm going to be focusing on basketball.

Why Basketball?

The primary reason is that the amount of randomness feels a lot lower than other sports. A team's possession can only end in 0, 1, 2, or 3 points, and then the other team takes over with the same four possible outcomes. There are also a lot of games.

Required Information

In order to make a prediction, we need three pieces of information:

  • Away team's average points scored per game
  • Away team's average allowed points per game (in other words, what their opponents score)
  • Home team's average pointsPerGame
  • Home team's pointsAllowed
  • League-wide average points per game.

To fill in our blanks this for this and all subsequent formulas & models, we're going to be using Basketball-Reference.com.

Each team's seasons are linked to from Basketball-Reference's teams page. Here's a link to the San Antonio Spurs stats for the 2020 season.

Screenshot of team stats

The PTS/G tells us the Spurs average 113.7 points per game, and Opp PTS/G says opponents playing against them average 114.7.

We can find league-wide averages linked directly from the BR site menu.

Screenshot of league averages

The average points scored across all teams in the league is 110.6.

An Example

Our example is the January 22, 2020 game between the San Antonio Spurs and the home team New Orleans Pelicans.

Let's gather the stats we need:

TeamAvg Points ScoredAverage Points Allowed
Spurs113.7114.7
Pelicans114.4117.6
League Average110.7110.7

Before we do any math, let's take a look at what the numbers are telling us.

Numbers Before Math

Both teams score less points than they allow their opponents to. In other words, both have losing records.

Both teams also score & allow more points than the league average. They play at a faster pace (we'll get into this later) which gives them more chances to shoot & score– but we already know their speed isn't them dominating.

With this intuition in place, we will run these averages through two formulas.

Formula 1: Just the Averages

Our first formula is to take the average of the team's scored points and the opponent's allowed points:

predictedPoints = (teamAvgPoints + opponentAvgAllowedPoints)/2

Let's predict the Spurs' score:

(113.7 + 117.6) / 2 = 115.65

And the Pelicans:

(114.4 + 114.7) / 2 = 114.55

So Formula 1 predicts the Spurs will beat the Pelicans with a score of 116 to 115.

Formula 2: League Average Adjusted

For this prediction, we are going to estimate the amount of points a team will score by dividing the number of points the team allows by the league average points scored per game. Then we multiply this number by the team's average points scored.

predictedPoints = (avgAllowedPoints/leagueAvg) * avgPointsScored

For the Spurs:

(114.7/110.7) * 113.7 = 117.8 predicted points

And the Pelicans:

(117.6/110.7) * 114.4 = 121.5 predicted points

This time our prediction is that Pelicans will win with a score of 122 to 118.

As an aside, this was Zion Williamson's first game in the NBA. He's supposed to be the next LeBron James or Michael Jordan (read: "the player of a generation"). Perhaps because of this hype, the Pelicans were favored to win by 3 points.

Reviewing this Example

We ended up with two predictions that didn't agree, so we would pass on making a definitive prediction.

That's just one game of the twelve that were held on January 22.

Doing this manually for the 11 other games would kind of suck.

Let's work on automating it.