liveBook · Manning

Runner

As explained in Statistics Slam Dunk

runner is an R package that provides functions for running calculations and analyzing values over sequential windows or streaks.

runner is an R package for scoping and sizing streaks. Its streak_run() function computes running sequences of consecutive values, making it useful for questions such as whether free-throw success follows a hot hand. section 16.1 section 16.4.1

library(tidyverse)
library(runner)

Load runner alongside tidyverse before preparing and analyzing sequential data. section 16.1

Measure free-throw streaks

Filter Giannis Antetokounmpo’s 707 free-throw records, then group by game date and create streak = streak_run(lag(points)). Grouping by date prevents a streak from carrying into another game. The resulting table counts makes and misses by streak length, calculates percentages, and supports a line chart of shooting percentage after consecutive makes. section 16.4.1

Compare with random sequences

Generate 700 fair coin flips with sample(), calculate streak_run(heads_tails), retain heads, and find the maximum streak. The simulated sequence reaches a run of 11 heads.

How Statistics Slam Dunk covers it

How deep it goes
Defines streak_run() through executable examples and output, but does not explain the package’s internal implementation.
Examples
Uses Giannis Antetokounmpo free throws, grouped game dates, streak summary tables, a line chart, and simulated coin flips.
What it assumes
Assumes basic R data manipulation while demonstrating package loading, filtering, grouping, mutation, summarization, and visualization.
What you can do after
Apply it via R to calculate consecutive-value runs, summarize outcomes by streak length, and visualize resulting percentages.
How it connects
Connects streak_run() with dplyr, tidyverse, ggplot2, lag(), grouping, and Laplace’s rule of succession.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.