Lecture 1

2025-05-05

Welcome!

Note on computation

  • A major aim of the course is to develop excellent computational skills in the applications of data science to sports analytics.
  • Course readings and assessments will be provided in both R and Python and students will have the option to choose between them.
  • Lecture examples will primarily be performed in R.

Dr. Samuel WK Wong

  • Grew up in beautiful Vancouver, BC, Canada
  • Studied Math and Stat at the Univ of British Columbia (BSc, 2008)
  • Continued with graduate school in Statistics at Harvard Univ (PhD, 2013)
  • First worked as a professor at University of Florida
  • Returned to Canada to join UWaterloo in 2018!

Interests

See my website https://swong.ca for more information!

As a professor:

  • Teaching

  • Research: developing statistical and computational methodology for applications, i.e. “data science” – protein folding, cell biology, structural engineering, and others

Other interests:

  • Piano, chess, Bible & theology, start-ups

David Awosoga

  • Grew up in Lethbridge, Alberta
  • Studied Applied Statistics & Economics at the University of Lethbridge (BSc, 2022)
  • Completed Master’s of Mathematics in Data Science at the University of Waterloo (MMath, 2024)
  • Currently a PhD Student in Statistics at the University of Waterloo, supervised by Dr. Wong

Interests

Research:

  • Sports analytics, spatiotemporal data analysis, Bayesian reinforcement learning

Current Roles:

  • Performance Data Scientist with Canadian Sport Institute Ontario (CSIO)
  • Assistant Coach (Scouting and Data Science) with the Waterloo Warriors Women’s Volleyball Team

Topic 0: Sports Analytics

Introduction

What is sports analytics?

Sports analytics is the analysis of data across different domains of sport, including business, performance evaluation, player acquisition, and health and safety.

Introduction

Why sports analytics?

You’re probably here because you like a sport, or multiple. You have questions about how to leverage data to better understand the inner workings of your sport of interest. Additionally, analyzing sports data is a great way to improve upon your data science, programming, and biomechanics skills! Projects are a great resume builder and will beef up your GitHub, and you can use them as examples of past work during interviews.

Introduction

How sports analytics? (What analytical software are used?)

Sports analytics was built from the open source community, and as such R, Python, and Julia are the typical languages of choice, augmented by SQL and Tableau.

Project Examples

Sports Analytics Scene at a Glance

What can you do with sports analytics?

  1. Form teams and collaborate on projects, hackathons, and competitions
  2. Share resources for tutorials and workshops to enhance our breadth of data science applications to sport
  3. Present research at and attend conferences
  4. Work directly for a team, the league front office, freelance, or at a third-party company

Projects, Hackathons, and Competitions

Examples:

Resources, Tutorials, and Workshops

Examples:

Research

Popular Journals:

Sports Jobs

Sports analytics jobs are increasing in popularity but have quickly become over-saturated with talented and passionate individuals. In a sector where supply out-paces demand, how can we ensure that we are competitive candidates? In this presentation we will survey the sports analytics job landscape and see what we can do to best prepare ourselves!

Advice from Industry Leaders

Dr. Scott Powers, former Assistant General Manager with the Houston Astros and current Professor of Sports Analytics at Rice University, has the following advice for those looking to be competitive candidates for jobs in sports analytics:

Advice from Industry Leaders

“When I was a hiring manager in analytics for the Dodgers, we would post an entry-level quantitative analyst position and receive nearly a thousand applications. Among those candidates, based on the application alone, roughly half would seem to be qualified for the entry-level position. Without the resources to interview 500 candidates, we had to decide which small subset of candidates would advance to the interview stage (this is its own challenge and a story for another day).

Advice from Industry Leaders

I relay this experience to you because it conveys some perspective from the other side of the job application process. How will you separate yourself (before the interview stage) from the many other candidates who could be qualified for the position? The best way to make your resume rise to the top of the stack is to work on a research project and present it at a sport analytics conference. If a resume reviewer is already familiar with your work (assuming it’s good work) before seeing your name in the candidate pool, then they are much more likely to offer you an interview.”

“-work on a research project and present it at a sport analytics conference”

On the horizon: Conferences

  • NESSIS - September 27 at Harvard University, abstracts due July 15
  • CMSAC - November TBD at Carnegie Mellon University, abstracts due early August
  • SABR Analytics Conference - Mid March, abstracts due late November
  • TISS - September 26-27 at the University of Toronto, abstracts due June 16

Most faculties (i.e. Math) here at UW provide funding to students presenting work at conferences!!

Questions?

Course Preliminaries

Topic 1: Collaboration and Version Control

Motivating Examples

  1. Project Collaboration
  2. Version Control
  3. Task Automation

Environment Setup

Integrating Git and GitHub with RStudio

  • Connect R to Git:
## install if needed (do this exactly once):
## install.packages("usethis")
library(usethis)
use_git_config(user.name = "Jane Doe", user.email = "jane@example.org")
  • Set up an HTTPS Personal Access Token (PAT) to connect Git to GitHub
usethis::create_github_token()
## you’ll be redirected to a GitHub page, don’t forget to copy the PAT!
gitcreds::gitcreds_set()
## paste the PAT

Integrating Git and GitHub with VSCode

  1. Install the GitHub Pull Requests and Issues extension
  2. Follow the prompts to authenticate your account, which should set up the authorization token automatically behind the scenes. Otherwise you can add it manually if you are not redirected back to VS Code.

Basic Git Commands

  • Clone: copy the contents of a local repository to a local folder
  • Push: copy file(s) from your local computer to the cloud
  • Pull: copy files(s) from the cloud to your local computer
  • Commit: move a changed local file to a local staging area
  • Stage: select files(s) that you want to commit
  • Branch: a working environment in the repository separate from the main working area

Personal Workflow

  • Clone an existing GitHub project or initialize a new directory (folder) for one
  • When editing files, periodically commit the project instead of just saving the individual file
  • Push commits to GitHub

Collaborative Workflow

  • Assuming that a project has already been pushed to GitHub:
    • Clone the project (once)
    • Pull changes from the main branch
    • Create your branch (once)
    • Periodically stage and commit edited files after saving
    • Push changes to GitHub
    • Make a pull request once you’re ready for your changes to be merged to the main branch

Using Git and GitHub

Documentation

  • Helpful commit messages

  • Code commenting

  • readme Files

  • Wikis

  • Document as much as you can, because a programmer’s worst enemy is themselves from a few [days/weeks/months/years] ago

Additional Materials

References

Next Up

  • Module 1: Introduction to Data Science
  • Assignment 1: Due May 12 @ 11 AM on Crowdmark pter 1-10
  • Assignment 1: Due May 12 @ 11 AM on Crowdmark