The raw data behind the story "The Complete History Of The NBA" https://projects.fivethirtyeight.com/complete-history-of-the-nba/ and our "2017-18 NBA Predictions" https://projects.fivethirtyeight.com/2018-nba-predictions/

nba_carmelo

## Format

Because of R package size restrictions, only a preview of the first 10 rows of this dataset is included; to obtain the entire dataset (1871 to 2017 games) see Examples below. A data frame with 10 rows representing games and 20 variables:

date

Date

season

Season year, 1947-2018

neutral

TRUE if the game was played on neutral territory, FALSE if not

playoff

TRUE if the game was a playoff game, FALSE if not

team1

The name of one participating team

team2

The name of the other participating team

elo1_pre

Team 1's Elo rating before the game

elo2_pre

Team 2's Elo rating before the game

elo_prob1

Team 1's probability of winning based on Elo rating

elo_prob2

Team 2's probability of winning based on Elo rating

elo1_post

Team 1's Elo rating after the game

elo2_post

Team 2's Elo rating after the game

carmelo1_pre

Team 1's CARMELO rating before the game

carmelo2_pre

Team 2's CARMELO rating before the game

carmelo1_post

Team 1's CARMELO rating after the game

carmelo2_post

Team 2's CARMELO rating after the game

carmelo_prob1

Team 1's probability winning based on CARMELO rating

carmelo_prob2

Team 2's probability of winning based on CARMELO rating

score1

Points scored by Team 1

score2

Points scored by Team 2

## Examples

# To obtain the entire dataset, run the following code:
library(dplyr)
library(tidyr)
library(janitor)
clean_names() %>%
mutate(
team1 = as.factor(team1),
team2 = as.factor(team2),
playoff = ifelse(playoff == "t", TRUE, FALSE),
playoff = ifelse(is.na(playoff), FALSE, TRUE),
neutral = ifelse(neutral == 1, TRUE, FALSE)
)#> Parsed with column specification:
#> cols(
#>   .default = col_logical(),
#>   date = col_date(format = ""),
#>   season = col_double(),
#>   neutral = col_double(),
#>   team1 = col_character(),
#>   team2 = col_character(),
#>   elo1_pre = col_double(),
#>   elo2_pre = col_double(),
#>   elo_prob1 = col_double(),
#>   elo_prob2 = col_double(),
#>   elo1_post = col_double(),
#>   elo2_post = col_double(),
#>   score1 = col_double(),
#>   score2 = col_double()
#> )#> See spec(...) for full column specifications.#> Warning: 34745 parsing failures.
#>   row            col           expected              actual                                                         file
#> 63158 carm-elo1_pre  1/0/T/F/TRUE/FALSE 1564.372491         'https://projects.fivethirtyeight.com/nba-model/nba_elo.csv'
#> 63158 carm-elo2_pre  1/0/T/F/TRUE/FALSE 1732.025482         'https://projects.fivethirtyeight.com/nba-model/nba_elo.csv'
#> 63158 carm-elo1_post 1/0/T/F/TRUE/FALSE 1570.47393668307    'https://projects.fivethirtyeight.com/nba-model/nba_elo.csv'
#> 63158 carm-elo2_post 1/0/T/F/TRUE/FALSE 1725.92403631693    'https://projects.fivethirtyeight.com/nba-model/nba_elo.csv'
#> 63158 carm-elo_prob1 1/0/T/F/TRUE/FALSE 0.40307778555455737 'https://projects.fivethirtyeight.com/nba-model/nba_elo.csv'
#> ..... .............. .................. ................... ............................................................
#> See problems(...) for more details.