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 Visualization > Data Driven Research around NFL Dome Team Performance

Data Driven Research around NFL Dome Team Performance

Daniel Donohue
Posted on Nov 5, 2015

Contributed by Daniel Donohue.  Daniel was a student of the NYC Data Science Academy 12-week full-time data science bootcamp program from Sep. 23 to Dec. 18, 2015.  This post was based on his first class project (due at the end of the 2nd week of the program).

Daniel Michael Donohue

4 November 2015

Introduction

The National Football League is unique among the four major American sports, in that its playersโ€™ images as modern-day gladiators often have the appropriate backdrop of driving wind, rain, snow, and cold. There are a handful of teams, however, that play their eight regular season home games inside domes, and it is not unreasonable to think that this might present some difficulty when moving outdoors late in the season.

Indeed, this is commonly discussed (perhaps anecdotally) as the NFL season gets late: โ€œSure, they do well in the comfort of their dome, but can they take their success on the road in poor weather conditions?โ€ The goal of this first project was to investigate just that. Namely, can we see visually whether an NFL team that plays their home games in a climate-controlled environment inherently suffers some disadvantage when playing outdoors, especially in inclement weather?

The Dataset

To address this question, we used a dataset obtained with license from Armchair Analysis that is comprised of twenty-four csv files covering every aspect of every play, team, game, and player from 2000-2014. This is a fascinating dataset, and thereโ€™s certainly a lot of insight to be gleaned from it. We only used two of the files for this project, though: one containing general game information (score, weather conditions, etc.); and one containing very specific game statistics.

Average Margin

The most obvious metric of a teamโ€™s performance is the final margin of the score, so this is where we began. The first visualization of this benchmark that we made was a simple graph of average margin versus NFL season, one for dome teams playing in open-air stadiums, and one for the rest of the NFL teams when on the road. Before this, we need to prepare the dataset for graphing.

# Load the required packages, the datasets, and create character vectors of 
# dome and outdoor teams.  
library(dplyr)
library(reshape2)
library(ggplot2)

game <- read.csv("nfl_00-14/csv/game.csv", stringsAsFactors = FALSE)
team <- read.csv("nfl_00-14/csv/team.csv", stringsAsFactors = FALSE)
dome.teams <- c("ATL", "MIN", "NO", "STL", "DET", "IND", "ARI", "HOU")
outdoor.teams <- unique(filter(game, !(h %in% dome.teams))$h)

# Add a column to the game dataframe for final margin from the perspective of
# the visting team.  A negative final margin indicates that the visiting 
# team lost.  
game <- mutate(game, v.margin=ptsv - ptsh)

# Create an object containing instances of dome teams playing in open-air
# stadiums, and outdoor teams playing away.  Note that the Dallas Cowboys 
# moved from an open-air stadium to a dome in the 2009 season.  
dome.at.outdoor <- filter(game, 
    (v %in% dome.teams | (v == "DAL" & seas > 2008)) & 
    (h %in% outdoor.teams))
outdoor.away <- filter(game, 
  (v %in% outdoor.teams | (v == "DAL" & seas <= 2008)))

Next, we group the dataframes dome.at.outdoor and outdoor.away by season and summarize by the average on the v.margin (visiting margin) column:

dome.seas.margin <- group_by(dome.at.outdoor, seas) %>%
    summarise(avg.away.margin=mean(v.margin))
outdoor.seas.margin <- group_by(outdoor.away, seas) %>%
    summarise(avg.away.margin=mean(v.margin))

# Melt these into a single dataframe for ggplot.
away.margin <- melt(list(dome.seas.margin, outdoor.seas.margin), 
    id.var=c("seas", "seas"))

Finally, we are ready to create the first plot.

avg.visiting.margin <- ggplot(data=away.margin, aes(x=seas, y=value, 
    colour=factor(L1), group=factor(L1))) +
    geom_line() +
    scale_color_manual(name="Away Margin in the NFL",
        breaks=c(1, 2), 
        labels=c("Dome Teams \n Playing Outdoors", 
            "Outdoor Stadium Teams' \n Away Margin"), 
        values=c('blue', 'orange')) +
    theme_bw() +
    xlab("Season") +
    ylab("Average Margin") +
    ggtitle("Average Margin of Victory in the NFL, 2000-2014")

avg.visiting.margin

LineThere is pretty wild fluctuation for dome teams, yet most years they do underperform when compared to the rest of the league. It is also interesting to note that NFL teams lose on the road by a little under a field goalโ€”at least some evidence that home-field advantage exists in the league.

Next, we want to see what the distribution of away margins are for dome teams and the rest of the NFL. Again, we first need to prepare a dataframe for visualization.

# Melt the dome and game dataframes into a single dataframe.  
away.all <- melt(list(dome.at.outdoor, outdoor.away), id.vars=c("gid", "gid"), 
    measure.vars=c("v.margin", "v.margin"))
# Calculate the average margins because I'm going to overlay these on the 
# density plots.  
mean.away.all <- group_by(away.all, L1) %>%
    summarise(mean.val=mean(value)) %>%
    select(L1, mean.val)

And we obtain this:

visiting.density <- ggplot(data=away.all, aes(x=value, 
        fill=factor(L1))) +
    geom_density(alpha=.2) +
    scale_fill_manual(name="",
        breaks=c(1, 2), 
        labels=c("Dome Teams \nPlaying Outdoors", 
                "Outdoor Stadium \nTeams Away"), 
        values=c("blue", "orange")) +
    geom_vline(data=mean.away.all, aes(xintercept=mean.val, 
        colour=factor(L1)), linetype="dashed", size=.75, alpha=.5) +
    scale_colour_manual(breaks=c(1, 2), values=c("blue", "orange")) +
    theme_bw() +
    xlab("Final Margin") +
    ylab("Density") +
    geom_text(data=mean.away.all, aes(x=4.1, y=.0375, label="-1.94 pts/game"), 
        color='orange', size=5) +
    geom_text(data=mean.away.all, aes(x=-10, y=.0375, label="-4.04 pts/game"), 
        color='blue', size=5) +
    ggtitle("Density Plots of Away Margin in the NFL, 2000-2014")

visiting.density

Density

The distribution for outdoor teams appears fairly normal. The distribution for dome teams has somewhat of a negative skew, which indicates that they tend to be on the receiving end of more blowouts. This seems to be in line with the initial hypothesis that dome teams indeed perform worse on the road than the rest of the league, but is this difference in means statistically significant? To get an idea, we can perform a two-sample t-test, with the alternative hypothesis that the true value of the average dome team away margin is less than that of the rest of the NFL.

t.test(dome.at.outdoor$v.margin, outdoor.away$v.margin, alternative = "less")
## 
##  Welch Two Sample t-test
## 
## data:  dome.at.outdoor$v.margin and outdoor.away$v.margin
## t = -3.68, df = 1247.1, p-value = 0.0001216
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
##      -Inf -1.16323
## sample estimates:
## mean of x mean of y 
## -4.047736 -1.943072

The p-value is extremely small. We are therefore led to reject the null hypothesis that the means are the same across the two groups, in favor of the alternative hypothesis that the mean visiting margin of dome teams playing outdoors is significantly less than the mean visiting margin for the rest of the NFL.

Inclement Weather

As stated above, the argument that dome teams perform worse in open-air stadiums is largely based on the assumption that they arenโ€™t as prepared to deal with inclement weather as their opponents. We therefore seek to compare various game statistics (passing yards, rushing yards, first downs, etc.) across different weather types. Since there are twenty-four unique game conditions in the original dataframe, we first group similar weather conditions using the following function to make the condition column less unwieldy.

weather = function(x) {
    if(x %in% c("Chance Rain", "Light Rain", "Rain", "Thunderstorms")) {
        return("Rain")
    }
    else if(x %in% c("Clear", "Fair", "Partly Sunny", "Mostly Sunny", "Sunny")) {
        return("Clear")
    }
    else if(x %in% c("Closed Roof", "Dome")) {
        return("Dome")
    }
    else if(x %in% c("Cloudy", "Partly Cloudy", "Mostly Cloudy")) {
        return("Cloudy")
    }
    else if(x %in% c("Foggy", "Hazy")) {
        return("Fog")
    }
    else {
        return("Snow")
    }
}

Next, the specific game statistics are in the team dataframe, while the game conditions are in the game dataframe. Luckily, both dataframes have a unique โ€œgame ID,โ€ so we can join the two dataframes on that value.

dome.weather <- inner_join(dome.at.outdoor, team, "gid") %>%
  # Filter out the outdoor teams that are hosting the dome teams.  
    filter(tname %in% dome.teams | (tname == "DAL" & seas > 2008)) %>%
  # Select weather condition, visiting margin, points scores, rushing first downs, 
  # passing first downs, first downs obtained through penalties, rushing yardage, 
  # passing yardage, penalties committed, red zone attempts, red zone conversions, 
  # short third-down attempts, short third-down conversions, long third-down attempts, and
  # long third-down conversions.  
    select(cond, v.margin, pts, rfd, pfd, ifd, ry, py, pen, 
        rza, rzc, s3a, s3c, l3a, l3c) %>%
  # Add columns for total first downs, red zone efficiency, and adjusted third-down
  # efficiency (which lends greater weight to long third-down conversions).  
    mutate(fd=rfd + pfd + ifd, rze=rzc / rza, 
        a3e= (s3c + 1.5 * l3c) / (s3a + l3a)) %>%
  # Drop irrelevant columns.  
    select(-c(rfd, pfd, ifd, rza, rzc, s3a, s3c, l3a, l3c)) %>%
    filter(cond != "") %>% # A few rows didn't have a condition recorded. 
  # Replace NaNs with 0 for teams that had no red zone attempts, and group 
  # similar weather conditions using the above-defined function.  
    mutate(rze=ifelse(is.nan(rze), 0, rze), cond=sapply(cond, weather)) %>%
    group_by(cond) %>%
    summarise_each(funs(mean))

Then, we melt the dataframe and plot it with ggplot2.

dome.weather <- melt(dome.weather, id.vars="cond")
levels(dome.weather$variable) <- c("Margin", "Points", "Rushing Yards", 
    "Passing Yards", "Penalty Yards", "First Downs", "Red Zone Efficiency", 
    "Adjusted Third Down Rate")

weather.stats <- ggplot(data=dome.weather, aes(x=factor(cond), y=value, 
        fill=factor(cond))) +
    geom_bar(stat="identity", position="dodge") +
    facet_wrap(~variable, nrow=3, scales="free") +
    scale_fill_brewer(name="Condition", palette="RdYlBu") +
    xlab("") +
    ylab("") +
    theme_bw() + 
  ggtitle("Dome Team Statistics in Different Conditions")

weather.stats

DomeBarFacetThis visualization seems to be pretty telling. Dome teams achieve lower totals in nearly every category in the snow and rain than they do in other conditions, losing by more than ten points on average in the snow. It is curious to observe that dome teams lose by more than nine points when they play in other teamsโ€™ domes.

For completeness, we can create the same visualization for outdoor teams playing in various weather conditions.

OutdoorBarFacetNote the scale on the y-axes. Contrasted with dome teams, we do not see as substantial a drop off in statistics in inclement weather; in fact, we see that, for instance, outdoor teams rush the ball better in snow and rain.

Temperature

Finally, we make a simple smoothed plot of total yardage (rushing yardage plus passing yardage) versus temperature (for temperatures below freezing), since this is the last adverse weather condition we have not considered yet. Again, we first need to join the dome and outdoor dataframes with the team dataframe to extract the yardage totals.

dome.temp <- inner_join(dome.at.outdoor, team, "gid") %>%
    mutate(tot.yds = ry + py) %>%
    select(temp, tot.yds) %>%
    filter(temp < 32) 

outdoor.temp <- inner_join(outdoor.away, team, "gid") %>%
  mutate(tot.yds = ry + py) %>%
  select(temp, tot.yds) %>%
  filter(temp < 32)

# Melt for ggplot2.  
yds.temp <- melt(list(dome.temp, outdoor.temp), 
                 id.var = c("temp", "temp"))

# Plot.  
temp.smooth <- ggplot(data=yds.temp, aes(x=temp, y=value, 
                color=factor(L1), group=factor(L1))) +
    geom_smooth(na.rm=TRUE, alpha=.1) +
  scale_color_manual(name="", breaks=c(1, 2), 
    labels=c("Dome Teams", 
              "Outdoor Stadium Teams"), 
    values=c('blue', 'orange')) +
    theme_bw() +
    xlab("Temperature") +
    ylab("Total Yards") +
  ggtitle("Yardage in Low Temperatures") +
    xlim(10, 32)

temp.smooth

YardTempSmoothThe locally weighted smoothing function for dome teams playing outdoors is increasing on most of the interval [10, 32], which means that they gain less yards as the temperature drops. Conversely, outdoor stadium teams seem to gain more yards as temperatures approach the extremely low ranges.  On the other hand, dome teams have higher yardage totals in temperatures approaching freezing.

Conclusion

The few visualizations that we constructed seem to suggest that dome teams do indeed perform worse in inclement weather and low temperatures. The next question to address is, then: Why? Is it simply because dome teams have been bad during 2000-2014, irrespective of the weather? Or perhaps are the rosters of dome teams constructed in a way that makes them excel in a dome setting, but leaves them vulnerable in hostile weather conditions?

A more rigorous analysis might take into account overall record, type of personnel, and might examine the dome teamโ€™s three units (offense, defense, and special teams) separately to see if there is a significant performance drop in any one area.

The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

About Author

Daniel Donohue

Daniel Donohue (A.B. Mathematics, M.S. Mathematics) spent the last three years as a Ph.D. student in mathematics studying topics in algebraic geometry, but decided a few short months ago that he needed a change in venue and career....
View all posts by Daniel Donohue >

Related Articles

Capstone
Catching Fraud in the Healthcare System
Data Analysis
Car Sales Report R Shiny App
Data Analysis
Injury Analysis of Soccer Players with Python
Capstone
The Convenience Factor: How Grocery Stores Impact Property Values
Capstone
Acquisition Due Dilligence Automation for Smaller Firms

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