install.packages(c("devtools", "tidyverse", "glmnet", "lme4", "mgcv", "ranger", "colorBlindness"))
STAT 479 (Fall 2025): Sports Analytics
Welcome to STAT 479 (Special Topics in Statistics)! This iteration of the course will focus on sports analytics.
All course material including lecture slides, code to reproduce the analyses discussed in lecture, and information about the projects will be posted on this website. So, please bookmark this page and check it regularly throughout the course.
A PDF copy of the course syllabus is available here and an HTML version of the syllabus is available here Below, you will find more details about course logistics and important information about setting up R.
Course Logistics
Lectures
Lectures will be held in-person Tuesdays and Thursdays from 11:00am to 12:15pm in Morgridge Hall 1524. Slides and code for each lecture will be posted on this website. Lectures will not be recorded. You are not permitted to record the lectures either.
Course Staff & Office Hours
Instructor: Sameer Deshpande (sameer.deshpande@wisc.edu). Instructor office hours will take place on:
- Mondays from 11:00am to 12:00pm in Morgridge Hall 5586 (beginning 9/8/25).
- Wednesdays from 3:00pm to 4:00pm in Morgridge Hall 5586 (beginning 9/3/25)
- Fridays from 3:00pm to 4:30pm in Morgridge Hall 5618 (beginning 9/5/25)
Office hours on Mondays and Wednesdays are designed for one-on-one meetings with the instructor. While the main purpose of Monday and Wednesday office hours is to discuss your specific experience and learning in the course, feel free to stop by to chat about your educational and career goals and/or any personal sports analytic projects you might be pursuing.
Friday office hours are intended for collaborative and small group work. During Friday office hours, small groups can step through analyses from lecture, work on the exercises, and on their team projects with the instructor and other students. Friday office hours are also a great way to brainstorm project ideas with and to get feedback from other teams.
If you have specific questions about the course content (e.g., parsing a particular bit of syntax or understanding a step in an analysis), I encourage you to ask the question on Piazza and to attend Friday office hours. If you cannot make the Monday or Wednesday office hours, please email me and suggest some times at which you are free.
Teaching Assistant: Zhexuan Liu (zhexuan.liu2@wisc.edu). TA office hours will be held 9:15am - 10:45am on Tuesday and Thursdays in Morgridge Hall 2515. TA office hours will begin on 9/16/25.
System Setup
As noted in the syllabus, this course will make extensive use of R. Even if you have prior experience, I strongly recommend installing the latest version of both R and RStudio at the beginning of the course. As of the time of this writing, that is R version 4.5.1 and RStudio version 2025.05.
Installing R & RStudio
You can download a version of R specific to your operating system from this website. After installing R, you should download and re-install RStudio from this website.
Whenever you update your version of R, you need to re-install the packages; this is a perennial source of frustration for many R users and some good-natured humor from others1.
Required Packages
Throughout the course, we will make extensive use of several tidyverse packages, primarily for data loading, pre-processing, and manipulation. We will also make extensive use of the packages glmnet, lme4, mgcv, and ranger for model fitting. As the course progresses, we will introduce and install new package as required. For the most part, these packages will be specific to a particular sport. Every package that we will use in this class is available through either (i) the Comprehensive R Archive Network (CRAN) or (ii) a public GitHub repository maintained by the packager developer. We typically install CRAN packages using the install.packages()
command. To install packages hosted on GitHub, we will use the install_github()
function in the devtools package, which is itself available on CRAN.
For visualizations, we will try to use colorblind-friendly palettes2 as much as possible. The package colorBlindness contains several palettes for diverging and qualitative data. We will use the Blue2DarkRed18Steps
palette from colorBlindness for making heatmaps (e.g., this one)
Prior to Lecture 2, please make sure you install the required packages.
I am also personally partial to the palette developed by Okabe & Ito, which is available using the palette.colors()
function. We will often use this palette to annotate scatter plots (e.g., this one in Lecture 9). Figure 1 shows the 9 colors contained in the Okabe-Ito palette.
<-
oi_colors palette.colors(palette = "Okabe-Ito")
par(mar = c(3,3,2,1), mgp = c(1.8, 0.5, 0))
plot(1:9, 1:9, pch = 16, cex = 4, col = oi_colors)
- 1
-
The
mar
argument reserves 3 margin lines for the bottom and left sides of the plot, 2 for the top, and 1 for the right. Themgp
argument specifies how the axis title, label, and lines are placed. - 2
- Plots large, filled circles with the palette colors
Footnotes
Even Hadley Wickham, who leads the tidyverse team at Posit, manually re-installs packages after every update↩︎
See these notes by Paul Tol for a lot of useful information about colorblindness and how different palettes are perceived by different people.↩︎