NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship 🏆 Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release 🎉
Free Lesson
Intro to Data Science New Release 🎉
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See 🔥
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular 🔥 Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New 🎉 Generative AI for Finance New 🎉 Generative AI for Marketing New 🎉
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular 🔥 Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular 🔥 Data Science R: Machine Learning Designing and Implementing Production MLOps New 🎉 Natural Language Processing for Production (NLP) New 🎉
Find Inspiration
Get Course Recommendation Must Try 💎 An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release 🎉
Free Lessons
Intro to Data Science New Release 🎉
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See 🔥
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > Data Science News and Sharing > NFL Statistics: An Exploratory Data Analysis

NFL Statistics: An Exploratory Data Analysis

Andre Toujas
Posted on Aug 29, 2017

INTRODUCTION

The mission: making more informed, “better” decisions when placing wagers on NFL football games.

In order to accomplish this mission, an interactive R Shiny Dashboard (link)  was created so that the user can select a specific team-opponent combination to obtain historical matchup performance trends in addition to variables correlated with beating the team’s user specified opponent.  

Once the user is able to gain information on how the selected team performs against the selected opponent, better gambling decisions based on statistical analysis can be made.  

R & R SHINY

R is an open-source computer programming language widely used for statistical analyses.  R is bundled with visualization packages that easily allows the programmers to display their statistical findings.  

R Shiny is a web application framework which allows users to interact with the data set being analyzed to produce visualizations as per the input parameters set by the user.  R Shiny is a package bundled with the RStudio integrated development environment (IDE).  

NFL BETTING CONCEPTS

There are 2 main types of wagers when betting on NFL games: the point spread and the point total.  The R Shiny Dashboard was tailored to present the data with the point spread and point total betting types in mind, but the data can be applied to other NFL wagers.

The Point Spread

Sportsbooks formulate a point spread (aka “line”) for each NFL game.  If the “line” is negative, the team mentioned preceding the line is favored by the amount of the line.  For example, if the New Orleans Saints are -9 vs the Atlanta Falcons and a gambler places a point spread wager on the Saints, the gambler needs the Saints to beat the Falcons by 10 or more points in order to win the bet (aka “cover”).  

If the Atlanta Falcons are +9 vs the New Orleans Saints and a gambler places a point spread wager on the Falcons, the gambler needs the Falcons to lose the game by 8 or less points in order to “cover” the bet.  If New Orleans wins by exactly 9 points, the bet is a draw (aka “push”); and no money is exchanged.  

In reality, sportsbooks charge the gambler a percentage (aka “vig”) of the bet to take the bet.  The gambler loses the percentage in a push bet, but that concept is outside the scope of the topics covered.

The Point Total

Sportsbooks also formulate a point total (aka “over/under”) for each NFL game.  A gambler can bet over or under on the combined points of both teams.  For example, if the “Over/Under” is set at 46 points and  a gambler bets the over, he can win if the two teams’ combined score is above that amount.

For example, if the Saints scored 34 points and the Falcons scored 20 points, the gambler wins the wager since a combined 54 points were scored in the game.  Just as in the point spread bet, if the combined score totals 46 points, the bet is a draw and no money is exchanged.

DATA SET

The data set used for the R Shiny web application was obtained from Pro Football Reference, which is an NFL statistic aggregating website (https://www.pro-football-reference.com).  Quarterback (QB), running back (RB) and wide receiver (WR) statistics from each game of the past five (5) NFL seasons--2012 through 2016--were compiled into a CSV file so that it could be loaded into the R Studio IDE.  

Reference the snapshot below for the QB statistics collected:

Reference the snapshot below for the WR statistics collected:

Reference the snapshot below for the RB statistics collected:

R SHINY WEB APPLICATION

HOME PAGE

The Home page is meant to illustrate that teams generally do not have very big swings in win total from season to season.  Also, the line graphs illustrate total wins (y-axis) by season (x-axis) with each color representing a team.  The graphs are separated by conference and division.  

The user can select a number for the win difference from year to year, and the table below will display the teams with a win total swing greater than the value selected.  For example, if the user selects 6 as the input, the table will update to display the 8 teams over the last 5 years that had a swing in total wins of 7 games or more.  

BETTING MENU, MATHCUP TABLES

The matchup tables sub-menu page under the betting menu is a way for the user to easily see tables containing the statistics of prior matchups between the selected team and the selected opponent.  The user can select the team for analysis and the opponent via the sidebar.  Reference the table below for a legend explaining the variable names in the tables:

Variable Dictionary Table:

Season: NFL season in which game occurred Week:  Week of game Team: Team for analysis X: Home or Away
Opponent: Upcoming opponent Result: Win, Lose or Tie ptsFor: Points scored by Team ptsAgst: Points scored by Opponent or defensive points allowed by Team
psYds: Team passing yards psTDs: Team passing TDs psInt: Interceptions thrown by Team QBR: Quarterback Rating (QB efficiency metric)
psYds: Team sacks allowed rsYds: Team rushing yards rsTD: Team rushing TDs

Receiving statistics were excluded from team analysis since the receiving statistics mirror the passing statistics.  For example, receiving yards for each team is equal to passing yards.

BETTING MENU, TEAM vs OPPONENT ANALYSIS

To analyze what variables are correlated to beating a specific opponent, a “Winning” variable  was created.  A value of 1 or 0 was assigned so that correlations could be determined.  

Then a variable correlation matrix was created/plotted so that the user can visualize how the variables are correlated to one another, specifically to beating the selected opponent.  

Additionally, the correlations (values) to the “Winning” variable were extracted and presented in a table so that the user would readily have access to that information.  See below for an example:

 .                    

BETTING MENU, CURRENT SEASON ANALYSIS

The final feature of this Shiny web application allows the user to analyze the current season performance of the selected team and opponent.  In the preceding features historical statistical information was analyzed, and the variable(s) most correlated to beating a specific opponent were obtained.  

This feature presents how the selected team is performing and how the defense of the selected opponent is performing for a specific variable that the user can select.  

Since the 2017 football season has not yet started, Week 12 of the 2016 season was arbitrarily selected and used in this example to present how the feature will operate.  

FUTURE ITEMS TO ADDRESS

There is room for improvement for this Shiny Web application.  The following items will be addressed:

  • Load more years
    • 5 years of historical data was limited.  This provided for some missing and inaccurate correlations.
  • Missing values
    • Addressing missing values fell outside the scope of this project but will be addressed in the near future.  
  • Load more variables
    • There are other variables that are likely correlated to performance/winning such as indoor vs outdoor, early season vs late season performance, etc.

The path forward for this web application would be to input sportsbook betting lines and predict scores of future games based on historical performance (both current season and prior seasons) via machine learning techniques.  

Once betting line information is received and scores of games are predicted, the predicted score can be compared against the betting lines to determine which wagers have positive expected value (EV).    

The skills the author demonstrated here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

About Author

Andre Toujas

“Why?” The question “why” has always intrigued Andre. That simple question is what made Andre pursue his degree in mechanical engineering, and answering “why” is what drives him as a data scientist. Two of his four NYCDSA projects...
View all posts by Andre Toujas >

Related Articles

Capstone
Acquisition Due Dilligence Automation for Smaller Firms
Machine Learning
Beware of Feature Importance for Business Decisions
Meetup
Building a Safer Future
Python
Tech Layoffs: Exploring the Trends and Industry Shifts
Meetup
Analysis of Mass Shootings and Gun Ownership in the United States

Leave a Comment

Cancel reply

You must be logged in to post a comment.

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    © 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application