Posts

For other R-related blogs and resources, checkout the blogroll.

Tidy Sports Analytics, Part 4: tidyverse

This is the final post in the tidy sports analytics series, in which I’ve been using play-by-play from the 2016 NFL season to demonstrate the power of the tidyverse. Previously, I’ve discussed: Part 1: Data manipulation using dplyr; Part 2: Data reshaping and tidying using tidyr; Part 3: Data visualization using ggplot2. This post doesn’t feature any new data analysis. Instead, I want to use this last post to talk about the tidyverse more generally and cover some of other advantages of using these packages for data analysis.

Tidy Sports Analytics, Part 3: ggplot2

This is the third post in the tidy sports analytics series. In this series, I’ve been demonstrating how the collection of tidyverse packages can be used to explore and analyze sports data. Specifically, I’ve been using the 2016 NFL play-by-play data from Armchair Analysis. Part one in the series showed how dplyr can be used for data manipulation, and part two demonstrated reshaping and tidying data using tidyr. This post focuses on data visualization using ggplot2.

Tidy Sports Analytics, Part 2: tidyr

This is the second in a series of posts that demonstrates how the tidyverse can be used to easily explore and analyze NFL play-by-play data. In part one, I used the dplyr package to calculate the offensive success rate of each NFL offense in during the 2016 season. However, when we left off, I noted that really we should look at the success rate of both offenses and defenses in order to get a better idea of which teams were the best overall.

Tidy Sports Analytics, Part 1: dplyr

Welcome to the first in a series of blog posts where I’ll be using sports data to demonstrate the power of the tidyverse tools in the context of sports analytics. The tidyverse is a suite of packages developed mainly by Hadley Wickham, with contributions from over 100 other people in the R community. The goal of the tidyverse is to provide easy to use R packages for a data science workflow that all follow a consistent philosophy and API.

Integrating Blogdown with GitHub Pages and Travis-CI

I recently converted my website from Jekyll to Hugo with blogdown. If you haven’t tried out blogdown yet, Yihui Xie just hosted a webinar that does a great job of introducing the package. This post won’t focus on how to use blogdown to create a website, but rather how to host that website on GitHub pages and use Travis-CI to automatically update the website. For this post, I’m assuming that you’re making a user or organization site.

Recreating the Datasaurus Dozen Using tweenr and ggplot2

If you haven’t seen it yet, there’s a great example of why it’s always important to visualize your data making its way around the Twitter-verse. A great demonstration of why we need to plot the data and never trust statistics tables! https://t.co/JyUb57v0or pic.twitter.com/hsivGZdpZ1 — Taha Yasseri (@TahaYasseri) May 1, 2017 Despite looking very different, all of these datasets have the same summary statistics to two decimal places. You can download the datasets, get details about the project, and read the whole paper by Justin Matejka and George Fitzmaurice here.

Previewing the 2017 Men's NCAA Basketball Tournament

March Madness officially tips off tomorrow with the First Four games in Dayton before the round of 64 begins on Thursday. In this post, we’ll look at each team’s chance of advancing and winning the national title. We’ll also look at who was help and hurt most by how the committee seeded the tournament. As always, the code and data for this post are available on my Github page. The Ratings The team ratings come from my sports analytics website, Hawklytics.

Predicting the Winner of the 2017 Big 12/SEC Challenge

The Big 12/SEC challenge tips off tomorrow. This will be the 4th year of this competition, and the Big 12 has never lost. In this post, we’ll use a Monte Carlo simulation to estimate the Big 12’s chances of continuing this streak for another year. As always, the code and data for this post are available on my Github page. The Ratings The team ratings come from my sports analytics website, Hawklytics.

Making Win Probability Plots with ggplot2

Last week I premiered my in game win probabilities for KU basketball. These have been available for a while on Hawklytics, but were always made after the game rather than in real time. Now that they are going live, I thought it would helpful to document how these are made using R and the ggplot2 package. Calculating Win Probability The win probabilities are based on the Elo ratings that I calculate for the team ratings on Hawkytics.

Evaluating Election Forecasts

After more than a year and a half, the 2016 presidential election is finally over, with Donald Trump projected to win. This is in contrast to many of the election forecasts, which almost unanimously predicted a victory for Hillary Clinton. Now that the results are in, we can finally answer the question of who did the best (or least worst?) job of forecasting the election. There are several ways we could look at this question, but for the purpose of this analysis we’ll focus on two.