Sentiment Analysis Throughout the NBA Playoffs

Written by:  Isabella Sio

In Correspondence to Sam Ventura’s class: 36-144 (Winning with Statistics in Sports)

Home court advantage has a surprising amount of weight in sports matches.  The reception of a crowd can help encourage a team to strive forward to win, bog them down with insults, or helping the team to take the hate of the crowd and make themselves stronger.

In our present day, tweets help to amplify this home court advantage and team pride.  Twitter helps to make this home court advantage global; tweets always spike up during games, rallying followers to support their team.  Stadiums have even begun incorporating live tweets in their breaks and intermissions, further emphasizing the global reach of tweets and its power in influencing the world of sports.  Twitter has slowly become a hub for live content and has been called a “cornerstone of our social media presence,” according to sports analysts and NFL social media managers, according to

While both teams seemed to be evenly matched with different but successful strategies, the Rockets were able to adapt theirs effectively while the Spurs struggled to find an opening to attack, leading to a 30-point deficit by halftime, a 39-point deficit at maximum, and a 27-point difference (most likely a salvageable minimum) when they lost.

To help analyze the effect of the home court advantage and the morale of fans on the game, the tweets of fans throughout and after the game were analyzed according to sentiment for each team.  The types of sentiment that the tweets were categorized in were anger, anticipation, disgust, fear, joy, the broader categories of negative and positive, sadness, surprise, and trust.  The data hopefully can provide an accurate representation of the mentality of the fans, which can be lined up at each point during the game.

In the first set of data, common words from tweets relating to the teams were gathered and organized in a bar graph.  The data was analyzed twice – once during halftime and once during the end of the game  – in order to chart growth.  One thousand tweets were gathered during each interval for each team.  In other words, 2000 tweets were analyzed for each team. The bar graphs below show the top 20 words.

Most of the words from both teams related to the game itself, such as “spurs”, “rockets”, “houston”, “san”, and “antonio”.  When running the function of tweets relating to the Spurs, a syntax error also pulled some tweets relating to President Trump’s recent comments on how “the Civil War could have been worked out” by misinterpreting the team “Spurs” as the verb “spurs”.  Since the Rockets were winning, their words were skewed towards a more positive side, while the Spurs’ tweets mostly remained in a neutral state. Additionally, Houston Rockets player James Harden was praised throughout the first half, leading to his stats – 16 points, 3 steals, 7 assists – as part of the top words within the Rockets’ most common words.  These Houston Rockets’ common words also seemed to intermingle with the Spurs’ common words, showing how the Rockets were clearly beating the Spurs and showing a larger popularity on social media.  Interestingly, there did not seem to be that much of a change when analyzing tweets from after the game.

The negative skew is mostly reflected in the bar graphs analyzing the amount of words in tweets that corresponded to the type of sentiment.  Utilizing R Studio, its Tidy Text Mining book, and the packages twitteR, plyr, tidytext, RSentiment, ggplot2, the code would analyze the words in each tweet and would categorize the words by sentiment.  Like the commonly used words, these graphs were also run during halftime and at the immediate conclusion of the game.  The graphs seem to accurately reflect the mood during halftime.  The words were analyzed by “anger”, “anticipation”, “disgust”, “fear”, “joy”, “negative”, “positive”, “sadness”, “surprise”, and “trust” sentiments.  On the Spurs side, there seems to be a near equal amount of negative and positive words used, with the “anger” and “fear” categories ranking highest after the “positive” and “negative” categories.  In contrast, there is a greater disparity between the amount of negative words used and the amount of positive words used in tweets regarding the Rockets.  Following the “positive and “negative” categories, “trust” is the highest ranking category, reflecting the high morale of the team resulting from the Rockets’ sizable lead.

During the end of the game, the sentiment bar graphs began to look more similar between the two teams.   At this point, the final outcome of the game had been decided and tweets regarding the general outcome of the game most likely started to occupy much of the Twitter stream.  The emotions of the fanbases also might have started to even out against each other, with the trust of a better game for the Spurs equaling the trust of the Rockets to continue a winning streak, or anger targeted against the Spurs for losing badly equaling an anger against the Rockets from Spurs fans.

Overall, we can conclude, especially from the Spurs tweets, that there will be a sharp imbalance between the morale of the two teams going forward.  Even if the sentiments of the two teams started to even out in the end as seen through Twitter, these emotions can just as easily be brought out in future games.  While a home-court advantage doesn’t seem to have a lot of weight towards the outcome of the Spurs’ game based on the data (especially since the Spurs are currently leading the playoffs right now 2-1), it can be argued that the deficit would have been a lot larger if the Spurs were losing this badly in the Toyota Center, the home court of the Houston Rockets.   If the negative reaction from the Rockets crowd coupled with the negative tweets from Spurs fans, the Spurs’ morale would have arguably been at a worse state from being flanked by both sides.




Leave a Reply